[GRASS-SVN] r55576 - grass/branches/develbranch_6/vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 30 14:54:48 PDT 2013
Author: neteler
Date: 2013-03-30 14:54:47 -0700 (Sat, 30 Mar 2013)
New Revision: 55576
Modified:
grass/branches/develbranch_6/vector/v.out.ogr/main.c
Log:
v.out.ogr: backport of r47878, fix for trac #1834
Modified: grass/branches/develbranch_6/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.out.ogr/main.c 2013-03-30 21:54:13 UTC (rev 55575)
+++ grass/branches/develbranch_6/vector/v.out.ogr/main.c 2013-03-30 21:54:47 UTC (rev 55576)
@@ -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;
@@ -648,6 +648,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:
@@ -677,6 +681,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