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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 21 13:26:12 PDT 2015


Author: martinl
Date: 2015-10-21 13:26:12 -0700 (Wed, 21 Oct 2015)
New Revision: 66564

Modified:
   grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr not supporting OFTInteger64 field type (#2769)
         add support also for Integer64List


Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2015-10-21 20:24:17 UTC (rev 66563)
+++ grass/trunk/vector/v.in.ogr/main.c	2015-10-21 20:26:12 UTC (rev 66564)
@@ -1087,11 +1087,24 @@
 		/**                                          OFTDate = 9           **/
 		/**                                          OFTTime = 10          **/
 		/**                                          OFTDateTime = 11      **/
+                /** Simple 64bit integer                     OFTInteger64 = 12     **/
+                /** List of 64bit integers                   OFTInteger64List = 13 **/
 
 		if (Ogr_ftype == OFTInteger) {
 		    sprintf(buf, ", %s integer", Ogr_fieldname);
 		}
-		else if (Ogr_ftype == OFTIntegerList) {
+		else if (Ogr_ftype == OFTInteger64) {
+                    if (strcmp(Fi->driver, "pg") == 0) 
+                        sprintf(buf, ", %s bigint", Ogr_fieldname);
+                    else {
+                        sprintf(buf, ", %s integer", Ogr_fieldname);
+                        if (strcmp(Fi->driver, "sqlite") != 0) 
+                            G_warning(_("Writing column <%s> with integer 64 as integer 32"),
+                                      Ogr_fieldname);
+                    }
+                }
+		else if (Ogr_ftype == OFTIntegerList ||
+                         Ogr_ftype == OFTInteger64List) {
 		    /* hack: treat as string */
 		    sprintf(buf, ", %s varchar ( %d )", Ogr_fieldname,
 			    OFTIntegerListlength);
@@ -1134,8 +1147,8 @@
 			      Ogr_fieldname, OFTIntegerListlength);
 		}
 		else {
-		    G_warning(_("Column type not supported (%s)"),
-			      Ogr_fieldname);
+		    G_warning(_("Column type (Ogr_ftype: %d) not supported (Ogr_fieldname: %s)"),
+			      Ogr_ftype, Ogr_fieldname);
 		    buf[0] = 0;
 		}
 		db_append_string(&sql, buf);
@@ -1219,7 +1232,9 @@
 		    Ogr_field = OGR_FD_GetFieldDefn(Ogr_featuredefn, i);
 		    Ogr_ftype = OGR_Fld_GetType(Ogr_field);
 		    if (OGR_F_IsFieldSet(Ogr_feature, i)) {
-			if (Ogr_ftype == OFTInteger || Ogr_ftype == OFTReal) {
+			if (Ogr_ftype == OFTInteger ||
+                            Ogr_ftype == OFTInteger64 ||
+                            Ogr_ftype == OFTReal) {
 			    sprintf(buf, ", %s",
 				    OGR_F_GetFieldAsString(Ogr_feature, i));
 			}
@@ -1240,7 +1255,8 @@
 #endif
 			else if (Ogr_ftype == OFTString ||
 			         Ogr_ftype == OFTStringList ||
-				 Ogr_ftype == OFTIntegerList) {
+				 Ogr_ftype == OFTIntegerList ||
+                                 Ogr_ftype == OFTInteger64List) {
 			    db_set_string(&strval, (char *)
 					  OGR_F_GetFieldAsString(Ogr_feature,
 								 i));
@@ -1266,7 +1282,8 @@
 #endif
 			else if (Ogr_ftype == OFTString ||
 			         Ogr_ftype == OFTStringList ||
-				 Ogr_ftype == OFTIntegerList) {
+				 Ogr_ftype == OFTIntegerList ||
+                                 Ogr_ftype == OFTInteger64List) {
 			    sprintf(buf, ", ''");
 			}
 			else {



More information about the grass-commit mailing list