[GRASS-SVN] r47782 - grass/trunk/db/drivers/ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 19 16:36:45 EDT 2011
Author: martinl
Date: 2011-08-19 13:36:45 -0700 (Fri, 19 Aug 2011)
New Revision: 47782
Modified:
grass/trunk/db/drivers/ogr/execute.c
grass/trunk/db/drivers/ogr/main.c
Log:
ogr-dbmi: fix db__driver_execute_immediate()
Modified: grass/trunk/db/drivers/ogr/execute.c
===================================================================
--- grass/trunk/db/drivers/ogr/execute.c 2011-08-19 16:19:59 UTC (rev 47781)
+++ grass/trunk/db/drivers/ogr/execute.c 2011-08-19 20:36:45 UTC (rev 47782)
@@ -41,17 +41,16 @@
G_debug(3, "\tSQL: '%s'", db_get_string(sql));
+ /* try RDBMS SQL */
+ OGR_DS_ExecuteSQL(hDs, db_get_string(sql), NULL, NULL);
+ if (CPLGetLastErrorType() == CE_None)
+ return DB_OK;
+
/* parse UPDATE statement */
res = parse_sql_update(db_get_string(sql), &table, &cols, &ncols, &where);
G_debug(3, "\tUPDATE: table=%s, where=%s, ncols=%d", table, where ? where : "", ncols);
- if (res != 0) {
- /* try RDBMS SQL */
- hLayer = OGR_DS_ExecuteSQL(hDs, db_get_string(sql), NULL, NULL);
- if (CPLGetLastErrorType() != CE_None)
- return DB_FAILED;
-
- return DB_OK;
- }
+ if (res != 0)
+ return DB_FAILED;
/* get OGR layer */
hLayer = OGR_DS_GetLayerByName(hDs, table);
@@ -179,10 +178,10 @@
strncpy(c, p, n);
c[n] = '\0';
- token = G_tokenize(c, ",");
+ token = G_tokenize2(c, ",", "'");
*ncols = G_number_of_tokens(token);
*cols = (column_info *)G_malloc(sizeof(column_info) * (*ncols));
-
+
for (n = 0; n < (*ncols); n++) {
itoken = G_tokenize(token[n], "=");
if (G_number_of_tokens(itoken) != 2)
Modified: grass/trunk/db/drivers/ogr/main.c
===================================================================
--- grass/trunk/db/drivers/ogr/main.c 2011-08-19 16:19:59 UTC (rev 47781)
+++ grass/trunk/db/drivers/ogr/main.c 2011-08-19 20:36:45 UTC (rev 47782)
@@ -20,7 +20,8 @@
#include <grass/dbmi.h>
-#include "ogr_api.h"
+#include <ogr_api.h>
+
#include "globals.h"
#include "dbdriver.h"
More information about the grass-commit
mailing list