[GRASS-SVN] r39618 - grass/trunk/db/drivers/ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 23 09:41:28 EDT 2009
Author: martinl
Date: 2009-10-23 09:41:28 -0400 (Fri, 23 Oct 2009)
New Revision: 39618
Modified:
grass/trunk/db/drivers/ogr/fetch.c
Log:
db ogr driver: report also fid value (if defined)
Modified: grass/trunk/db/drivers/ogr/fetch.c
===================================================================
--- grass/trunk/db/drivers/ogr/fetch.c 2009-10-23 12:22:13 UTC (rev 39617)
+++ grass/trunk/db/drivers/ogr/fetch.c 2009-10-23 13:41:28 UTC (rev 39618)
@@ -38,11 +38,16 @@
*/
int db__driver_fetch(dbCursor * cn, int position, int *more)
{
- cursor *c;
+ int i, col;
+ int ogrType, sqlType;
+
dbToken token;
dbTable *table;
- int i, col;
+ dbColumn *column;
+ dbValue *value;
+ cursor *c;
+
G_debug(3, "db_driver_fetch()");
/* get cursor token */
@@ -92,12 +97,26 @@
/* get the data out of the descriptor into the table */
table = db_get_cursor_table(cn);
- col = -1;
+
+ /* check fid column */
+ if (strlen(OGR_L_GetFIDColumn(c->hLayer)) > 0) {
+ column = db_get_table_column(table, 0);
+ ogrType = db_get_column_host_type(column);
+ sqlType = db_get_column_sqltype(column);
+
+ value = db_get_column_value(column);
+ value->i = OGR_F_GetFID(c->hFeature);
+ G_debug(3, "fidcol '%s': ogrType %d, sqlType %d: val = %d",
+ db_get_column_name(column), ogrType, sqlType, value->i);
+
+ col = 0;
+ }
+ else {
+ col = -1;
+ }
+
+ /* loop attributes */
for (i = 0; i < c->ncols; i++) {
- int ogrType, sqlType;
- dbColumn *column;
- dbValue *value;
-
if (!(c->cols[i])) {
continue;
} /* unknown type */
More information about the grass-commit
mailing list