Skip to content

Commit

Permalink
v.in.ogr: skip columns with unsupported data type instead of failing …
Browse files Browse the repository at this point in the history
…to import (OSGeo#2630)

* skip binary columns

* remove copied comment

* indent + warning message

* handle all unsupported column types with d-flag

* remove second warning

* Update vector/v.in.ogr/main.c

Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>

* implement suggestion from review

* cleanup from review

* simplify warning

Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>
  • Loading branch information
2 people authored and neteler committed Nov 7, 2023
1 parent e3a1b62 commit 32f3742
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions vector/v.in.ogr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,8 @@ int main(int argc, char *argv[])
if (key_idx[layer] > -1 && key_idx[layer] == i)
continue; /* skip defined key (FID column) */

i_out++;
i_out++;

Ogr_field = OGR_FD_GetFieldDefn(Ogr_featuredefn, i);
Ogr_ftype = OGR_Fld_GetType(Ogr_field);

Expand Down Expand Up @@ -1175,13 +1175,14 @@ int main(int argc, char *argv[])
Ogr_fieldname, OFTIntegerListlength);
}
else {
G_warning(_("Column type (Ogr_ftype: %d) not supported (Ogr_fieldname: %s)"),
Ogr_ftype, Ogr_fieldname);
buf[0] = 0;
col_info[i_out].type = G_store(buf);
}
G_free(Ogr_fieldname);
}
/* handle columns of unsupported data type */
G_warning(_("Column <%s> of unsupported data type \"%s\" is omitted from import"),
Ogr_fieldname, OGR_GetFieldTypeName(Ogr_ftype));
i_out--;
ncols_out--;
}
G_free(Ogr_fieldname);
}

/* fix duplicate column names */
done = 0;
Expand Down Expand Up @@ -1388,10 +1389,6 @@ int main(int argc, char *argv[])
db_double_quote_string(&strval);
G_rasprintf(&sqlbuf, &sqlbufsize, ", '%s'", db_get_string(&strval));
}
else {
/* column type not supported */
G_rasprintf(&sqlbuf, &sqlbufsize, "%c", '\0');
}
}
else {
/* G_warning (_("Column value not set" )); */
Expand Down

0 comments on commit 32f3742

Please sign in to comment.