|
@@ -261,6 +261,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
if (format == GV_ASCII_FORMAT_POINT) {
|
|
if (format == GV_ASCII_FORMAT_POINT) {
|
|
int i, rowlen, ncols, minncols, *coltype, *coltype2, *collen, nrows;
|
|
int i, rowlen, ncols, minncols, *coltype, *coltype2, *collen, nrows;
|
|
|
|
+ char **colsample;
|
|
int n_int = 0, n_double = 0, n_string = 0;
|
|
int n_int = 0, n_double = 0, n_string = 0;
|
|
char buf[1000];
|
|
char buf[1000];
|
|
struct field_info *Fi;
|
|
struct field_info *Fi;
|
|
@@ -277,7 +278,7 @@ int main(int argc, char *argv[])
|
|
unlink(tmp);
|
|
unlink(tmp);
|
|
|
|
|
|
points_analyse(ascii, tmpascii, fs, td, &rowlen, &ncols, &minncols,
|
|
points_analyse(ascii, tmpascii, fs, td, &rowlen, &ncols, &minncols,
|
|
- &nrows, &coltype, &collen, skip_lines, xcol, ycol,
|
|
|
|
|
|
+ &nrows, &coltype, &colsample, &collen, skip_lines, xcol, ycol,
|
|
zcol, catcol, region_flag->answer, ignore_flag->answer);
|
|
zcol, catcol, region_flag->answer, ignore_flag->answer);
|
|
|
|
|
|
G_verbose_message(_("Maximum input row length: %d"), rowlen);
|
|
G_verbose_message(_("Maximum input row length: %d"), rowlen);
|
|
@@ -312,16 +313,20 @@ int main(int argc, char *argv[])
|
|
}
|
|
}
|
|
|
|
|
|
if (coltype[xcol] == DB_C_TYPE_STRING) {
|
|
if (coltype[xcol] == DB_C_TYPE_STRING) {
|
|
- G_fatal_error(_("'%s' column is not of number type"), "x");
|
|
|
|
|
|
+ G_fatal_error(_("'%s' column is not of number type, "
|
|
|
|
+ "encountered: '%s'"), "x", colsample[xcol]);
|
|
}
|
|
}
|
|
if (coltype[ycol] == DB_C_TYPE_STRING) {
|
|
if (coltype[ycol] == DB_C_TYPE_STRING) {
|
|
- G_fatal_error(_("'%s' column is not of number type"), "y");
|
|
|
|
|
|
+ G_fatal_error(_("'%s' column is not of number type, "
|
|
|
|
+ "encountered: '%s'"), "y", colsample[ycol]);
|
|
}
|
|
}
|
|
if (zcol >= 0 && coltype[zcol] == DB_C_TYPE_STRING) {
|
|
if (zcol >= 0 && coltype[zcol] == DB_C_TYPE_STRING) {
|
|
- G_fatal_error(_("'%s' column is not of number type"), "z");
|
|
|
|
|
|
+ G_fatal_error(_("'%s' column is not of number type, "
|
|
|
|
+ "encountered: '%s'"), "z", colsample[zcol]);
|
|
}
|
|
}
|
|
if (catcol >= 0 && coltype[catcol] == DB_C_TYPE_STRING) {
|
|
if (catcol >= 0 && coltype[catcol] == DB_C_TYPE_STRING) {
|
|
- G_fatal_error(_("'%s' column is not of number type"), "cat");
|
|
|
|
|
|
+ G_fatal_error(_("'%s' column is not of number type, "
|
|
|
|
+ "encountered: '%s'"), "cat", colsample[catcol]);
|
|
}
|
|
}
|
|
|
|
|
|
/* Create table */
|
|
/* Create table */
|
|
@@ -467,12 +472,14 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
switch (coltype[i]) {
|
|
switch (coltype[i]) {
|
|
case DB_C_TYPE_INT:
|
|
case DB_C_TYPE_INT:
|
|
- if (ctype == DB_C_TYPE_DOUBLE) {
|
|
|
|
|
|
+ /* coltype=int and colsample=NULL indicate,
|
|
|
|
+ * an empty column, so we don't report anything. */
|
|
|
|
+ if (ctype == DB_C_TYPE_DOUBLE && colsample[i]) {
|
|
G_warning(_("Column number %d <%s> defined as double "
|
|
G_warning(_("Column number %d <%s> defined as double "
|
|
"has only integer values"), i + 1,
|
|
"has only integer values"), i + 1,
|
|
db_get_column_name(column));
|
|
db_get_column_name(column));
|
|
}
|
|
}
|
|
- else if (ctype == DB_C_TYPE_STRING) {
|
|
|
|
|
|
+ else if (ctype == DB_C_TYPE_STRING && colsample[i]) {
|
|
G_warning(_("Column number %d <%s> defined as string "
|
|
G_warning(_("Column number %d <%s> defined as string "
|
|
"has only integer values"), i + 1,
|
|
"has only integer values"), i + 1,
|
|
db_get_column_name(column));
|
|
db_get_column_name(column));
|
|
@@ -481,8 +488,10 @@ int main(int argc, char *argv[])
|
|
case DB_C_TYPE_DOUBLE:
|
|
case DB_C_TYPE_DOUBLE:
|
|
if (ctype == DB_C_TYPE_INT) {
|
|
if (ctype == DB_C_TYPE_INT) {
|
|
G_fatal_error(_("Column number %d <%s> defined as integer "
|
|
G_fatal_error(_("Column number %d <%s> defined as integer "
|
|
- "has double values"), i + 1,
|
|
|
|
- db_get_column_name(column));
|
|
|
|
|
|
+ "has double values, encountered: '%s'"),
|
|
|
|
+ i + 1,
|
|
|
|
+ db_get_column_name(column),
|
|
|
|
+ colsample[i]);
|
|
}
|
|
}
|
|
else if (ctype == DB_C_TYPE_STRING) {
|
|
else if (ctype == DB_C_TYPE_STRING) {
|
|
G_warning(_("Column number %d <%s> defined as string "
|
|
G_warning(_("Column number %d <%s> defined as string "
|
|
@@ -493,13 +502,15 @@ int main(int argc, char *argv[])
|
|
case DB_C_TYPE_STRING:
|
|
case DB_C_TYPE_STRING:
|
|
if (ctype == DB_C_TYPE_INT) {
|
|
if (ctype == DB_C_TYPE_INT) {
|
|
G_fatal_error(_("Column number %d <%s> defined as integer "
|
|
G_fatal_error(_("Column number %d <%s> defined as integer "
|
|
- "has string values"), i + 1,
|
|
|
|
- db_get_column_name(column));
|
|
|
|
|
|
+ "has string values, encountered: '%s'"),
|
|
|
|
+ i + 1, db_get_column_name(column),
|
|
|
|
+ colsample[i]);
|
|
}
|
|
}
|
|
else if (ctype == DB_C_TYPE_DOUBLE) {
|
|
else if (ctype == DB_C_TYPE_DOUBLE) {
|
|
G_fatal_error(_("Column number %d <%s> defined as double "
|
|
G_fatal_error(_("Column number %d <%s> defined as double "
|
|
- "has string values"), i + 1,
|
|
|
|
- db_get_column_name(column));
|
|
|
|
|
|
+ "has string values, encountered: '%s'"),
|
|
|
|
+ i + 1, db_get_column_name(column),
|
|
|
|
+ colsample[i]);
|
|
}
|
|
}
|
|
if (length < collen[i]) {
|
|
if (length < collen[i]) {
|
|
G_fatal_error(_("Length of column %d <%s> (%d) is less than "
|
|
G_fatal_error(_("Length of column %d <%s> (%d) is less than "
|