Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient
In directory sc8-pr-cvs1:/tmp/cvs-serv30290
Modified Files:
PGOutputPacket.cs PGResponsePacket.cs
Log Message:
* Added new test case for money fields.
* Fixed money datatype handling.
Index: PGOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient/PGOutputPacket.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PGOutputPacket.cs 18 Jul 2003 22:46:22 -0000 1.3
--- PGOutputPacket.cs 20 Jul 2003 09:59:28 -0000 1.4
***************
*** 206,212 ****
case DbType.Single:
- case DbType.Currency:
WriteInt(size);
WriteFloat(Convert.ToSingle(parameter.Value));
break;
--- 206,216 ----
case DbType.Single:
WriteInt(size);
WriteFloat(Convert.ToSingle(parameter.Value));
+ break;
+
+ case DbType.Currency:
+ WriteInt(size);
+ WriteInt(Convert.ToInt32(Convert.ToSingle(parameter.Value)*100));
break;
Index: PGResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient/PGResponsePacket.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PGResponsePacket.cs 17 Jul 2003 21:13:05 -0000 1.4
--- PGResponsePacket.cs 20 Jul 2003 09:59:28 -0000 1.5
***************
*** 127,138 ****
}
! public decimal ReadMoney()
{
FloatLayout floatValue = new FloatLayout();
floatValue.f = base.ReadSingle();
floatValue.i0 = IPAddress.HostToNetworkOrder(floatValue.i0);
! return Convert.ToDecimal(floatValue.i0)/100;
}
--- 127,141 ----
}
! public float ReadMoney()
{
+ /*
FloatLayout floatValue = new FloatLayout();
floatValue.f = base.ReadSingle();
floatValue.i0 = IPAddress.HostToNetworkOrder(floatValue.i0);
+ */
+ float val = (float)ReadInt();
! return val/100;
}
|