[fdo-trac] #231: SQLServer Spatial: The order of inserted
properties counts
FDO
trac_fdo at osgeo.org
Tue Jan 22 13:34:14 EST 2008
#231: SQLServer Spatial: The order of inserted properties counts
---------------------------------+------------------------------------------
Reporter: danstoica | Owner: danstoica
Type: defect | Status: new
Priority: major | Milestone: 3.3.0
Component: SQLServer Spatial | Version: 3.2.0
Severity: 3 | Keywords:
External_id: |
---------------------------------+------------------------------------------
This is about a SqlServer2008 bug. Say we have this insert statement:
INSERT INTO dbo.TEST_GEOM("ID", "GEOM", "STR1”) VALUES (?,
Geometry::STGeomFromText(?, 0), ?);
SQLPrepare() will succeed but describe columns (SQLDescribeParam) will
fail with “[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index”
for each column in the statement.
What the provider's ODBC driver is doing in such case is to default the
column type to CHAR, length=100. This is exactly what we are experiencing:
all the strings get padded with spaces up to 101 chars.
Why is it failing? Apparently the geometry column has to be bound as the
last column in the insert statement. This statement will succeed:
INSERT INTO dbo.TEST_GEOM("ID", "STR1”, "GEOM",) VALUES (?, ?,
Geometry::STGeomFromText(?, 0));
Until MS is fixing the bug a workaround is feasable: in the provider just
place the geometry properties at the end of the insert string.
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/231>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list