[GRASS-SVN] r57016 - grass/trunk/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 5 01:45:13 PDT 2013


Author: mmetz
Date: 2013-07-05 01:45:13 -0700 (Fri, 05 Jul 2013)
New Revision: 57016

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

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2013-07-04 20:43:28 UTC (rev 57015)
+++ grass/trunk/vector/v.in.ogr/main.c	2013-07-05 08:45:13 UTC (rev 57016)
@@ -1024,9 +1024,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;
@@ -1038,8 +1038,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 *)
@@ -1048,24 +1048,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