Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient
In directory sc8-pr-cvs1:/tmp/cvs-serv32566
Modified Files:
PGType.cs
Log Message:
* source/PGCommandBuilder.cs:
- Fixed casing in private methods and visibility level.
* source/PGDataReader.cs:
* source/PGDbType.cs:
* source/PGParameter.cs:
* source/NPGClient/PGType.cs:
- Added better andling of datatypes.
Index: PGType.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient/PGType.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PGType.cs 12 Jul 2003 08:11:23 -0000 1.1.1.1
--- PGType.cs 14 Jul 2003 10:28:23 -0000 1.2
***************
*** 20,23 ****
--- 20,25 ----
using System.Data;
+ using PostgreSql.Data.PGSqlClient;
+
namespace PostgreSql.Data.NPGClient
{
***************
*** 26,37 ****
#region FIELDS
! private int oid;
! private string name;
! private DbType dbType;
! private Type systemType;
! private int arrayType;
! private short formatCode;
! private int size;
! private bool isVector;
#endregion
--- 28,40 ----
#region FIELDS
! private int oid;
! private string name;
! private DbType dbType;
! private Type systemType;
! private int arrayType;
! private short formatCode;
! private int size;
! private bool isVector;
! private PGDbType providerType;
#endregion
***************
*** 79,82 ****
--- 82,90 ----
}
+ public PGDbType ProviderType
+ {
+ get { return providerType; }
+ }
+
#endregion
***************
*** 97,100 ****
--- 105,192 ----
this.size = size;
this.isVector = isVector;
+
+ setProviderType();
+ }
+
+ #endregion
+
+ #region PRIVATE_METHODS
+
+ private void setProviderType()
+ {
+ switch(dbType)
+ {
+ case DbType.Byte:
+ providerType = PGDbType.Byte;
+ break;
+
+ case DbType.Boolean:
+ providerType = PGDbType.Boolean;
+ break;
+
+ case DbType.AnsiString:
+ case DbType.String:
+ providerType = PGDbType.VarChar;
+ break;
+
+ case DbType.AnsiStringFixedLength:
+ case DbType.StringFixedLength:
+ providerType = PGDbType.Char;
+ break;
+
+ case DbType.Binary:
+ case DbType.Object:
+ providerType = PGDbType.Binary;
+ break;
+
+ case DbType.Date:
+ providerType = PGDbType.Date;
+ break;
+
+ case DbType.Time:
+ providerType = PGDbType.Time;
+ break;
+
+ case DbType.DateTime:
+ providerType = PGDbType.TimeStamp;
+ break;
+
+ case DbType.Int16:
+ case DbType.UInt16:
+ providerType = PGDbType.Int2;
+ break;
+
+ case DbType.Int32:
+ case DbType.UInt32:
+ providerType = PGDbType.Int4;
+ break;
+
+ case DbType.Int64:
+ case DbType.UInt64:
+ providerType = PGDbType.Int8;
+ break;
+
+ case DbType.Single:
+ providerType = PGDbType.Float;
+ break;
+
+ case DbType.Decimal:
+ providerType = PGDbType.Decimal;
+ break;
+
+ case DbType.Double:
+ providerType = PGDbType.Double;
+ break;
+
+ case DbType.Currency:
+ providerType = PGDbType.Currency;
+ break;
+
+ case DbType.Guid:
+ case DbType.VarNumeric:
+ case DbType.SByte:
+ default:
+ throw new InvalidOperationException("Invalid data type specified.");
+ }
}
|