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

Frank Warmerdam warmerdam at pobox.com
Fri Jan 25 16:23:21 EST 2008


Tamas Szekeres wrote:
> 2008/1/25, Frank Warmerdam <warmerdam at pobox.com>:
>> What other types are supportted when casting fields via your new mechanism?
>> I'd like to see the RFC explain how each of the OGR field types would
>> be represented in these cast directives.
>>
> 
> Frank,
> 
> I consider converting to string, float, and integer makes sense with
> the OGR field types. I've descibed this option in the proposal using
> the SQL pseudo syntax description:
> 
> <data type> ::= character [ ( field_length ) ]
>                 | float [ ( field_length ) ]
>                 | integer [ ( field_length ) ]
> Should I add more description about this topic in the RFC?

Tamas,

Sorry, I guess I missed that.

How will you handle precision for floating point fields?

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.

> SQL92 specifies some additional types like datetime for example.
> However in case of the datetime type GetFieldAsDatetime doesn't really
> support using other than the datetime as the source type so it doesn't
> really support type conversion.

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.

>> BTW, I didn't notice any test scripts in the proposed patch.  That would
>> also be needed though I'd be willing to write the tests for the new feature
>> if you like.
>>
> 
> I'm indeed not an expert in writing python scripts, therefore I would
> really appreciate if you were help me out. I can update the RFC
> accordingly.
> I'm using ogrinfo and ogr2ogr for making the SQL specific tests in my side.

Yes, please just list that I will add test scripts in the RFC.

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list