Opened 13 years ago

Closed 7 years ago

#767 closed defect (fixed)

SqlServer Spatial : Can't use SqlDataReader on Geometry

Reported by: bscott Owned by: danstoica
Priority: blocker Milestone: 3.6.0
Component: SQLServer Spatial Version: 3.6.0
Severity: 3 Keywords:
Cc: External ID:

Description

SqlDataReader throw an exception if there is a geometry column in the SQL statement. Exception : RDBMS(ODBC): Geometry conversion error. Explanation: When the SqlServer Spatial provider get geometries from SqlServer it expect to have wkb Geometry. FeatureReader concatenate the "STAsBinary()" function to the geometry column name before sending the query to SqlServer but SqlDataReader does not do that.

My suggestion would be to remove the STAsBinary function from the FeatureReader and handle the convertion directly in the geom_convertFromSqlServer_S (Geom.c) function. I don't know exactly how to do that, maybe there is an internal SqlServer API that can does that for us?

In the mean while i think it would be better if the provider returns null Geometry if it can't convert it. Actually it throws an exception and the SqlDataReader become useless as soon as the table has a geometry column.

Attachments (2)

sqlsrvGeomNull35.patch (814 bytes ) - added by bscott 13 years ago.
sqlsrvGeomNull36.patch (747 bytes ) - added by bscott 13 years ago.

Download all attachments as: .zip

Change History (4)

by bscott, 13 years ago

Attachment: sqlsrvGeomNull35.patch added

by bscott, 13 years ago

Attachment: sqlsrvGeomNull36.patch added

comment:1 by bscott, 13 years ago

I'm just discovering that Romica Dascalescu has made this modification, Thanks Romanica. But my little very simple patches are still very usefull for release 3.5 and 3.6

Bruno Scott

comment:2 by jng, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.