Ticket #2691 (closed defect: fixed)
OGR PGeo driver should recognize datetime fields as OFTDateTime rather than OFTString
| Reported by: | jjr8 | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.6.0 |
| Component: | OGR_SF | Version: | svn-trunk |
| Severity: | normal | Keywords: | pgeo odbc |
| Cc: |
Description
(I am unsure what component this ticket should be categorized as. Please adjust as appropriate.)
Currently, MS Access datetime fields are recognized as OFTString. See OGRPGeoLayer::BuildFeatureDefn() in /trunk/gdal/ogr/ogrsf_frmts/pgeo/ogrpgeolayer.cpp@15662#L101):
switch( poStmt->GetColType(iCol) ) { case SQL_INTEGER: oField.SetType( OFTInteger ); break; case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: oField.SetType( OFTBinary ); break; case SQL_DECIMAL: oField.SetType( OFTReal ); oField.SetPrecision( poStmt->GetColPrecision(iCol) ); break; case SQL_FLOAT: case SQL_REAL: case SQL_DOUBLE: oField.SetType( OFTReal ); oField.SetWidth( 0 ); break; default: /* leave it as OFTString */; }
Datetime fields are essential for many applications. For certain applications, the caller will not know the field type ahead of time and will want to get it from OGR. As a workaround, the caller can try to parse a date and then conclude that the field contains dates, but this cumbersome and does not work in all situations.
Please update the PGeo driver to recognize datetime for GDAL 1.6.0. If there are no developer resources for this, I may be able to contribute a fix. Having datetime support for ESRI personal geodatabases is pretty important for my application and it would be better to fix OGR than to kludge up a workaround in my own code.

