[GRASS-SVN] r73048 - grass/branches/releasebranch_7_4/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 3 15:06:44 PDT 2018
Author: mmetz
Date: 2018-08-03 15:06:44 -0700 (Fri, 03 Aug 2018)
New Revision: 73048
Modified:
grass/branches/releasebranch_7_4/vector/v.in.ogr/dsn.c
grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c
Log:
v.in.ogr: use column type 'text' when appropriate (backport trunk r73033)
Modified: grass/branches/releasebranch_7_4/vector/v.in.ogr/dsn.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.in.ogr/dsn.c 2018-08-03 21:56:57 UTC (rev 73047)
+++ grass/branches/releasebranch_7_4/vector/v.in.ogr/dsn.c 2018-08-03 22:06:44 UTC (rev 73048)
@@ -11,6 +11,8 @@
dsn = G_store(opt_dsn);
return dsn;
+
+ /* input OGR dsn and GRASS db connections are independent of each other */
/* TODO: remove below code, or use it in e.g. a new v.in.pg */
if (G_strncasecmp(opt_dsn, "PG:", 3) == 0) {
Modified: grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c 2018-08-03 21:56:57 UTC (rev 73047)
+++ grass/branches/releasebranch_7_4/vector/v.in.ogr/main.c 2018-08-03 22:06:44 UTC (rev 73048)
@@ -1058,14 +1058,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