Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.in.ogr: skip columns with unsupported data type instead of failing to import #2630

Merged
merged 9 commits into from
Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Comment on lines -1178 to -1181
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the current behaviour, add

i_out--;

remove

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