[GRASS-SVN] r57017 - grass/branches/develbranch_6/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 5 03:49:47 PDT 2013


Author: mmetz
Date: 2013-07-05 03:49:46 -0700 (Fri, 05 Jul 2013)
New Revision: 57017

Modified:
   grass/branches/develbranch_6/vector/v.in.ogr/main.c
Log:
v.in.ogr: fix OGR field evaluation

Modified: grass/branches/develbranch_6/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ogr/main.c	2013-07-05 08:45:13 UTC (rev 57016)
+++ grass/branches/develbranch_6/vector/v.in.ogr/main.c	2013-07-05 10:49:46 UTC (rev 57017)
@@ -878,9 +878,9 @@
 			if (Ogr_ftype == OFTInteger || Ogr_ftype == OFTReal) {
 			    sprintf(buf, ", %s",
 				    OGR_F_GetFieldAsString(Ogr_feature, i));
+			}
 #if GDAL_VERSION_NUM >= 1320
 			    /* should we use OGR_F_GetFieldAsDateTime() here ? */
-			}
 			else if (Ogr_ftype == OFTDate || Ogr_ftype == OFTTime
 				 || Ogr_ftype == OFTDateTime) {
 			    char *newbuf;
@@ -892,8 +892,8 @@
 			    sprintf(buf, ", '%s'", db_get_string(&strval));
 			    newbuf = G_str_replace(buf, "/", "-");	/* fix 2001/10/21 to 2001-10-21 */
 			    sprintf(buf, "%s", newbuf);
+			}
 #endif
-			}
 			else if (Ogr_ftype == OFTString ||
 				 Ogr_ftype == OFTIntegerList) {
 			    db_set_string(&strval, (char *)
@@ -902,24 +902,31 @@
 			    db_double_quote_string(&strval);
 			    sprintf(buf, ", '%s'", db_get_string(&strval));
 			}
-
+			else {
+			    /* column type not supported */
+			    buf[0] = 0;
+			}
 		    }
 		    else {
 			/* G_warning (_("Column value not set" )); */
 			if (Ogr_ftype == OFTInteger || Ogr_ftype == OFTReal) {
 			    sprintf(buf, ", NULL");
+			}
 #if GDAL_VERSION_NUM >= 1320
+			else if (Ogr_ftype == OFTDate ||
+				 Ogr_ftype == OFTTime || 
+				 Ogr_ftype == OFTDateTime) {
+			    sprintf(buf, ", ''");
 			}
+#endif
 			else if (Ogr_ftype == OFTString ||
-				 Ogr_ftype == OFTIntegerList ||
-				 Ogr_ftype == OFTDate) {
-#else
-			}
-			else if (Ogr_ftype == OFTString ||
 				 Ogr_ftype == OFTIntegerList) {
-#endif
 			    sprintf(buf, ", ''");
 			}
+			else {
+			    /* column type not supported */
+			    buf[0] = 0;
+			}
 		    }
 		    db_append_string(&sql, buf);
 		}



More information about the grass-commit mailing list