[gdal-dev] RFC 21: OGR SQL type cast and field name alias

Tamas Szekeres szekerest at gmail.com
Fri Jan 25 17:57:57 EST 2008


2008/1/25, Frank Warmerdam <warmerdam at pobox.com>:
>
> How will you handle precision for floating point fields?
>

We could easily support that by using the SQL92 numeric type as:
numeric [ ( field_length [, field_precision ] ) ]

I'll update the RFC accordingly.

> What about casting something to be an integer list, string list or floating
> point list?  I don't mind it not being supported, but at least we should
> be explicit on that point in the RFC.
>

I cannot support these easily since the corresponding conversion
routines are missing in the OGR code. We have no such kind of types in
SQL92 either so it could only be an OGR specific extension.

>
> In theory if we have a string formatted properly we should be
> able to convert it to date/time format.  I see OGRFeature::SetField(int,const
> char*) uses OGRParseDate() to set date/time fields from string input.  I
> think this would be quite a useful cast.
>

Yes, I've possibly missed that. I'll add support converting to the
datetimes as well. Here is my proposed data type definition that
contains all of the changes mentioned above.

<data type> ::= character [ ( field_length ) ]
                | float [ ( field_length ) ]
                | numeric [ ( field_length [, field_precision ] ) ]
                | integer
                | timestamp

Because of these changes I'll have to add SWQ_DATETIME to the
swq_field_type struct as well.

Best regards,

Tamas


More information about the gdal-dev mailing list