Opened 18 years ago
Last modified 17 years ago
#1321 closed defect
[OGR-ODBC] : DECIMAL field not recognised — at Initial Version
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.2 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | warmerdam |
Description
e-mail conversation orifinal question : I am trying to access an ODBC database using the ogr virtual layer access (using shp2img). The layer seems to be defined properly as far as I know. It looks something like : ... CONNECTION "<OGRVRTDataSource> <OGRVRTLayer name='AL05AK0001'> <SrcDataSource>ODBC:@sos_test</SrcDataSource> <SrcSQL>SELECT * FROM t_ResEau_Station_Data WHERE Site_Number = 'AL05AK0001'</SrcSQL> <GeometryType>wkbPoint</GeometryType> <GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding='PointFromColumns' x='Longitude' y='Latitude'/> </OGRVRTLayer> </OGRVRTDataSource>" The error message is the following : msOGRFileNextShape(): OGR error. Attempt to use STRING field `Longitude' with numeric comparison `>'. <br> If I just use the SrcLayer instead of the SrcSQL, It seems to work ok : <SrcDataSource>ODBC:@sos_test</SrcDataSource> <SrcLayer>t_ResEau_Station_Data</SrcLayer> <GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding='PointFromColumns' x='Longitude' y='Latitude'/> Frank's last e-mail > if I do an ogrinfo the Latitude/Longitude is reported as being String > * if I do access the db using php and echo the field types, I get Latitude DECIMAL and Longitude DECIMAL Assefa, Ah. I suspect that the ODBC driver is not recognising DECIMAL as a numeric field type, and so it falls back to treating it as a String. And now that I think about it, the extra spatial constraint is being interpreted within the OGR code for SrcSQL while for a conventional table they are passed through to the actual ODBC driver which understands DECIMAL properly. The proper solution likely is fixing the OGR ODBC driver to understand the decimal field type. If you could file a bug against OGR listing the database you are using and the SQL declaration for the field in that database I can try and get this fixed sooner or later.
Note:
See TracTickets
for help on using tickets.