[GRASS-SVN] r73033 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 3 07:47:55 PDT 2018
Author: mmetz
Date: 2018-08-03 07:47:55 -0700 (Fri, 03 Aug 2018)
New Revision: 73033
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
v.in.ogr: use column type 'text' when appropriate
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2018-08-03 06:09:27 UTC (rev 73032)
+++ grass/trunk/vector/v.in.ogr/main.c 2018-08-03 14:47:55 UTC (rev 73033)
@@ -1059,14 +1059,19 @@
fwidth = OGR_Fld_GetWidth(Ogr_field);
/* TODO: read all records first and find the longest string length */
- if (fwidth == 0) {
+ if (fwidth == 0 && strcmp(Fi->driver, "dbf") == 0) {
G_warning(_("Width for column %s set to 255 (was not specified by OGR), "
"some strings may be truncated!"),
Ogr_fieldname);
fwidth = 255;
}
- sprintf(buf, "varchar ( %d )", fwidth);
- col_info[i_out].type = G_store(buf);
+ if (fwidth == 0) {
+ col_info[i_out].type = "text";
+ }
+ else {
+ sprintf(buf, "varchar ( %d )", fwidth);
+ col_info[i_out].type = G_store(buf);
+ }
}
else if (Ogr_ftype == OFTStringList) {
/* hack: treat as string */
More information about the grass-commit
mailing list