[GRASS-SVN] r39266 - grass/trunk/vector/v.in.ascii
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 20 01:03:10 EDT 2009
Author: hamish
Date: 2009-09-20 01:03:10 -0400 (Sun, 20 Sep 2009)
New Revision: 39266
Modified:
grass/trunk/vector/v.in.ascii/main.c
grass/trunk/vector/v.in.ascii/points.c
Log:
don't guess column type for missing values (patch from MarkusM, trac #198; merge from devbr6)
Modified: grass/trunk/vector/v.in.ascii/main.c
===================================================================
--- grass/trunk/vector/v.in.ascii/main.c 2009-09-20 05:00:14 UTC (rev 39265)
+++ grass/trunk/vector/v.in.ascii/main.c 2009-09-20 05:03:10 UTC (rev 39266)
@@ -188,7 +188,7 @@
/* specifying zcol= implies that a 3D map is needed */
if (zcol >= 0 && !zcoorf->answer)
- zcoorf->answer = 1;
+ zcoorf->answer = TRUE;
if (zcoorf->answer && format == FORMAT_POINT && zcol < 0)
G_fatal_error(_("Please specify reasonable z column"));
@@ -294,15 +294,15 @@
}
/* Create table */
- make_table = 0;
+ make_table = FALSE;
for (i = 0; i < ncols; i++) {
if (xcol != i && ycol != i && zcol != i && catcol != i) {
- make_table = 1;
+ make_table = TRUE;
break;
}
}
if (t_flag->answer) {
- make_table = 0;
+ make_table = FALSE;
}
if (make_table) {
@@ -337,7 +337,7 @@
switch (coltype[i]) {
case DB_C_TYPE_INT:
- G_verbose_message("Column: %d type: integer", i + 1);
+ G_message("Column: %d type: integer", i + 1);
if (!columns_opt->answer) {
sprintf(buf, "int_%d integer", n_int + 1);
db_append_string(&sql, buf);
@@ -349,7 +349,7 @@
n_int++;
break;
case DB_C_TYPE_DOUBLE:
- G_verbose_message("Column: %d type: double", i + 1);
+ G_message("Column: %d type: double", i + 1);
if (!columns_opt->answer) {
sprintf(buf, "dbl_%d double precision", n_double + 1);
db_append_string(&sql, buf);
@@ -357,7 +357,7 @@
n_double++;
break;
case DB_C_TYPE_STRING:
- G_verbose_message("Column: %d type: string length: %d",
+ G_message("Column: %d type: string length: %d",
i + 1, collen[i]);
if (!columns_opt->answer) {
sprintf(buf, "str_%d varchar(%d)", n_string + 1,
Modified: grass/trunk/vector/v.in.ascii/points.c
===================================================================
--- grass/trunk/vector/v.in.ascii/points.c 2009-09-20 05:00:14 UTC (rev 39265)
+++ grass/trunk/vector/v.in.ascii/points.c 2009-09-20 05:03:10 UTC (rev 39266)
@@ -215,6 +215,11 @@
}
}
+ len = strlen(tokens[i]);
+ /* do not guess column type for missing values */
+ if (len == 0)
+ continue;
+
G_debug(4, "row %d col %d: '%s' is_int = %d is_double = %d",
row, i, tokens[i], is_int(tokens[i]),
is_double(tokens[i]));
@@ -230,7 +235,6 @@
}
/* string */
coltype[i] = DB_C_TYPE_STRING;
- len = strlen(tokens[i]);
if (len > collen[i])
collen[i] = len;
}
More information about the grass-commit
mailing list