[gdal-dev] OGR SQL Server driver - Default FID values when there is no FID column?

Tamas Szekeres szekerest at gmail.com
Wed Sep 15 16:38:56 EDT 2010


Jim,

The layers created with this driver should always have a FID column which is
an identity column with primary key constraint. Therefore the else part of
the implementation is a bit theoretical and not really used.

Best regards,

Tamas



2010/9/15 <James.Koch at gtri.gatech.edu>

>  Tamas, thanks for the SQL Server driver.  I also did some development on a SQL Server driver for the FalconView software, using OGR's existing MySQL driver as a reference.  One issue I saw was with setting a default FID value, when no FID column is present.  In OGRMSSQLSpatialLayer::GetNextRawFeature(), you set the value to an incrementing counter:
>
>
>
>     if( pszFIDColumn != NULL && poStmt->GetColId(pszFIDColumn) > -1 )
>
>         poFeature->SetFID(
>
>             atoi(poStmt->GetColData(poStmt->GetColId(pszFIDColumn))) );
>
>     else
>
>         poFeature->SetFID( iNextShapeId );
>
>
>
> Maybe you addressed this elsewhere in your code, but it seems like this causes problems if you expect the FID value to always be preserved for any given feature.  The FID value for a feature will be different before & after a filter is applied to the data set, since new OGRFeature objects are created each time.
>
>
>
> Is my understanding of the situation and the driver code correct?  If so,
> should the FID value stay constant?
>
>
>
> Thanks!
>
>
>
> Jim Koch
>
> Georgia Tech Research Institute
>
> FalconView Developer
>
> www.falconview.org
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100915/182bb4b7/attachment.html


More information about the gdal-dev mailing list