Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv13454
Modified Files:
PgOutputPacket.cs PgResponsePacket.cs
Log Message:
2003-10-27 Carlos Guzmán Álvarez <car...@te...>
* source/NPgClient/PgOutputPacket.cs:
* source/NPgClient/PgResponsePacket.cs:
- Added some canges to interval datatype handling.
Index: PgOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PgOutputPacket.cs 26 Oct 2003 14:58:04 -0000 1.15
--- PgOutputPacket.cs 27 Oct 2003 12:25:21 -0000 1.16
***************
*** 132,137 ****
public void WriteInterval(TimeSpan interval)
{
! this.WriteDouble(interval.TotalSeconds);
! this.WriteInt(0);
}
--- 132,140 ----
public void WriteInterval(TimeSpan interval)
{
! int months = (interval.Days / 30);
! int days = (interval.Days % 30);
!
! this.WriteDouble(interval.Subtract(TimeSpan.FromDays(months * 30)).TotalSeconds);
! this.WriteInt(months);
}
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PgResponsePacket.cs 26 Oct 2003 11:32:34 -0000 1.15
--- PgResponsePacket.cs 27 Oct 2003 12:25:21 -0000 1.16
***************
*** 220,227 ****
public TimeSpan ReadInterval()
{
! double interval = this.ReadDouble();
! int timezone = (-1)*(this.ReadInt()/3600);
! return TimeSpan.FromSeconds(interval);
}
--- 220,229 ----
public TimeSpan ReadInterval()
{
! double intervalTime = this.ReadDouble();
! int intervalMonth = this.ReadInt();
! TimeSpan interval = TimeSpan.FromSeconds(intervalTime);
!
! return interval.Add(TimeSpan.FromDays(intervalMonth*30));
}
***************
*** 237,242 ****
DateTime time = this.ReadTime();
int timezone = (-1)*(this.ReadInt()/3600);
! return time;
}
--- 239,264 ----
DateTime time = this.ReadTime();
int timezone = (-1)*(this.ReadInt()/3600);
+
+ string format = "{0:D2}{1}{2:D2}{3}{4:D2}{5}";
+ if (timezone > 0)
+ {
+ format = "{0:D2}{1}{2:D2}{3}{4:D2}+{5}";
+ }
+
+ StringBuilder timeWithTZ = new StringBuilder();
+ timeWithTZ.AppendFormat(
+ format,
+ time.Hour,
+ CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator,
+ time.Minute,
+ CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator,
+ time.Second,
+ timezone);
! return DateTime.Parse(
! timeWithTZ.ToString(),
! CultureInfo.CurrentCulture.DateTimeFormat,
! DateTimeStyles.NoCurrentDateDefault |
! DateTimeStyles.AllowWhiteSpaces);
}
|