[pgsqlclient-checkins] SF.net SVN: pgsqlclient: [167] trunk/PostgreSqlClient/source/PostgreSql/Data/
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2006-05-31 18:36:44
|
Revision: 167 Author: carlosga_fb Date: 2006-05-31 11:36:25 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=167&view=rev Log Message: ----------- 2006-05-31 Carlos Guzman Alvarez (car...@gm...) - Committed initial support for fetching PostGIS Box2D values. Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs 2006-05-31 18:35:53 UTC (rev 166) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs 2006-05-31 18:36:25 UTC (rev 167) @@ -307,9 +307,9 @@ schemaRow["NumericScale"] = DBNull.Value; } schemaRow["DataType"] = this.GetFieldType(i); - schemaRow["ProviderType"] = this.GetProviderType(i); + schemaRow["ProviderType"] = this.GetProviderDbType(i); schemaRow["IsLong"] = this.IsLong(i); - schemaRow["IsRowVersion"] = false; + schemaRow["IsRowVersion"] = this.CultureAwareCompare(this.GetName(i), "oid"); schemaRow["IsUnique"] = false; schemaRow["IsAliased"] = this.IsAliased(i); schemaRow["IsExpression"] = this.IsExpression(i); @@ -664,12 +664,22 @@ return (TimeSpan)GetValue(i); } - public PgPoint GetPgPoint(int i) + public PgTimeSpan GetPgTimeSpan(int i) + { + this.CheckPosition(); + this.CheckIndex(i); + + return new PgTimeSpan(this.GetTimeSpan(i)); + } + + #region \xB7 Geometric Types \xB7 + + public PgPoint GetPgPoint(int i) { this.CheckPosition(); this.CheckIndex(i); - return (PgPoint)this.GetPgValue(i); + return (PgPoint)this.GetProviderSpecificValue(i); } public PgBox GetPgBox(int i) @@ -677,7 +687,7 @@ this.CheckPosition(); this.CheckIndex(i); - return (PgBox)this.GetPgValue(i); + return (PgBox)this.GetProviderSpecificValue(i); } public PgLSeg GetPgLSeg(int i) @@ -685,7 +695,7 @@ this.CheckPosition(); this.CheckIndex(i); - return (PgLSeg)this.GetPgValue(i); + return (PgLSeg)this.GetProviderSpecificValue(i); } public PgCircle GetPgCircle(int i) @@ -693,7 +703,7 @@ this.CheckPosition(); this.CheckIndex(i); - return (PgCircle)this.GetPgValue(i); + return (PgCircle)this.GetProviderSpecificValue(i); } public PgPath GetPgPath(int i) @@ -701,7 +711,7 @@ this.CheckPosition(); this.CheckIndex(i); - return (PgPath)this.GetPgValue(i); + return (PgPath)this.GetProviderSpecificValue(i); } public PgPolygon GetPgPolygon(int i) @@ -709,23 +719,34 @@ this.CheckPosition(); this.CheckIndex(i); - return (PgPolygon)this.GetPgValue(i); - } + return (PgPolygon)this.GetProviderSpecificValue(i); + } - public PgTimeSpan GetPgTimeSpan(int i) - { - this.CheckPosition(); - this.CheckIndex(i); + #endregion - return new PgTimeSpan(this.GetTimeSpan(i)); - } + #region \xB7 PostGIS Types \xB7 - public object GetPgValue(int i) + public PgBox2D GetPgBox2D(int i) + { + this.CheckPosition(); + this.CheckIndex(i); + + return (PgBox2D)this.GetProviderSpecificValue(i); + } + + #endregion + + public override Type GetProviderSpecificFieldType(int i) + { + return this.GetFieldType(i); + } + + public override object GetProviderSpecificValue(int i) { this.CheckPosition(); this.CheckIndex(i); - switch (this.GetProviderType(i)) + switch (this.GetProviderDbType(i)) { case PgDbType.Interval: return this.GetPgTimeSpan(i); @@ -735,7 +756,7 @@ } } - public int GetPgValues(object[] values) + public override int GetProviderSpecificValues(object[] values) { return this.GetValues(values); } @@ -820,6 +841,11 @@ return this.command.Statement.RowDescriptor.Fields[i].DataType.Size; } + private PgDbType GetProviderDbType(int i) + { + return (PgDbType)this.command.Statement.RowDescriptor.Fields[i].DataType.DataType; + } + private int GetNumericPrecision(int i) { #warning "Add implementation" @@ -832,11 +858,6 @@ return 0; } - private PgDbType GetProviderType(int i) - { - return (PgDbType)this.command.Statement.RowDescriptor.Fields[i].DataType.DataType; - } - private bool IsNumeric(int i) { if (i < 0 || i >= this.FieldCount) @@ -916,6 +937,11 @@ } } + private bool IsCommandBehavior(CommandBehavior behavior) + { + return ((behavior & this.behavior) == behavior); + } + private bool CultureAwareCompare(string strA, string strB) { return CultureInfo.CurrentCulture.CompareInfo.Compare( Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs 2006-05-31 18:35:53 UTC (rev 166) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgDbType.cs 2006-05-31 18:36:25 UTC (rev 167) @@ -26,7 +26,9 @@ Binary , Boolean , Box , - Byte , + Box2D , + Box3D , + Byte , Char , Circle , Currency , This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |