MySQL decimal field rounded to nearest integer

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Feb 22 16:30:05 EST 2005


On Tue, 22 Feb 2005 15:57:32 -0500, Stephane Lessard
<LESSARDST at dfo-mpo.gc.ca> wrote:
> I use an ODBC connection, and it works fine when I test this connection with
> another tool. The values are ok. My data used to be in an Access DB, and it
> worked fine then. So I suspect that OGR does not support MySQL properly for
> decimal fields.
> 
> Does anyone have a suggestion, workaround or comment?

Stéphane,

First, to confirm, you see this problem when using ogr to access
MySQL tables via ODBC, is that right?  So the issue is with decimal
field handling in the OGR ODBC driver? 

An "ogrinfo" report for the table in question - along with a Mysql
dump of the field definitions would be helpful ... ideally in a 
GDAL/OGR bugzilla report. 

The code responsible for field type classification for OGRs 
ODBC driver is in:

  gdal/ogr/ogrsf_frmts/odbc/ogrodbclayer.cpp 

The method is OGRODBCLayer::BuildFeatureDefn().  

There is handling specifically for the ODBC types 
SQL_INTEGER, SQL_DECIMAL, SQL_FLOAT, SQL_REAL
and SQL_DOUBLE.  All others are treated as strings.  
The SQL_DECIMAL is supposed to be treated as a generic
floating point value. 

I need to establish: 
 o What OGR field type is getting used for the field. 
 o What ODBC (SQL_*)  field type code OGR is getting from ODBC
    for the field. 

Also, could you confirm what version of GDAL/OGR you are using?
1.2.5? 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list