Opened 19 years ago
Closed 19 years ago
#1255 closed defect (fixed)
MySQL decimal field rounded to nearest integer
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | GDAL Support | Version: | 4.5 |
Severity: | major | Keywords: | |
Cc: |
Description
The fields that are supposed to be MySQL "decimal" are rounded, and displayed as integer by ogrinfo and MapServer. For example, in my query template I have the following: ... Depth: [Depth] m <br> ... The value in my MySQL DB is a decimal (8,3), for example "10.4". In my query result page, I get "Depth: 10 m". The same happens with every decimal field. The field is rounded, not truncated. The problem occurs when using ogr (1.2.5) to access MySQL tables via ODBC. Frank Warmerdam is aware of this issue.
Change History (5)
comment:2 by , 19 years ago
Status: | new → assigned |
---|
I will address this today or tomorrow. I tried a when the bug was first created, but got bogged down in setting up MySQL ODBC access on my linux box. With the suggestion that this is a broader problem. With the suggestion that this is a broader ODBC problem, I will try on windows where ODBC is already setup.
comment:3 by , 19 years ago
Stephane, Could you confirm whether you encountered this on windows or Linux (or both)?
comment:5 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in CVS. It turns out that ODBC "decimal" fields were capturing the width but not the precision of the field in gdal/ogr/ogrsf_frmts/odbc/ogrodbclayer.cpp. In this did not affect OGR's capturing of the proper values, but the default textual formatter (OGRFeature::GetAsString()) formats according to the stored format. If the width was 0 (format unknown) then %.16g was used. Otherwise a specific width and precision format string was used and this cause the decimals to be discarded in formatting. This problem affects all ODBC decimal field access within OGR regardless of the backend database.
Note:
See TracTickets
for help on using tickets.