[GRASS-SVN] r55575 - grass/branches/releasebranch_6_4/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 30 14:54:13 PDT 2013


Author: neteler
Date: 2013-03-30 14:54:13 -0700 (Sat, 30 Mar 2013)
New Revision: 55575

Modified:
   grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c
Log:
v.out.ogr: backport of r47878, fix for trac #1834

Modified: grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c	2013-03-30 18:17:01 UTC (rev 55574)
+++ grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c	2013-03-30 21:54:13 UTC (rev 55575)
@@ -67,7 +67,7 @@
     int type, cat;
 
     /* Attributes */
-    int doatt = 0, ncol = 0, colsqltype, colctype, keycol = -1;
+    int doatt = 0, ncol = 0, colsqltype, colctype, colwidth, keycol = -1;
     struct field_info *Fi = NULL;
     dbDriver *Driver = NULL;
     dbHandle handle;
@@ -647,6 +647,10 @@
 		G_debug(2, "col %d: %s (%s)", i, db_get_column_name(Column),
 			db_sqltype_name(colsqltype));
 		colctype = db_sqltype_to_Ctype(colsqltype);
+                colwidth = db_get_column_length(Column);
+                G_debug(3, "col %d: %s sqltype=%d ctype=%d width=%d",
+                        i, db_get_column_name(Column), colsqltype, 
+                        colctype, colwidth);
 
 		switch (colctype) {
 		case DB_C_TYPE_INT:
@@ -676,6 +680,8 @@
 		if (!nocat_flag->answer) {
 		    Ogr_field =
 			OGR_Fld_Create(db_get_column_name(Column), ogr_ftype);
+                    if (ogr_ftype == OFTString && colwidth > 0) 
+                        OGR_Fld_SetWidth(Ogr_field, colwidth);
 		    OGR_L_CreateField(Ogr_layer, Ogr_field, 0);
 		    OGR_Fld_Destroy(Ogr_field);
 		}



More information about the grass-commit mailing list