Skip to content

Commit

Permalink
v.in.ogr: fix escape table column name during creating table (#3605)
Browse files Browse the repository at this point in the history
* v.in.ogr: fix escape table column name during creating table

Which allow create DB table column name with reserved keyword.

* Use SQL standard double quotes instead of single quotes
  • Loading branch information
tmszi authored and neteler committed Apr 23, 2024
1 parent 36fef11 commit 86e988f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vector/v.in.ogr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,12 +1224,12 @@ int main(int argc, char *argv[])

/* Create table */
i = 0;
sprintf(buf, "create table %s (%s %s", Fi->table, col_info[i].name,
col_info[i].type);
sprintf(buf, "create table %s (\"%s\" %s", Fi->table,
col_info[i].name, col_info[i].type);
db_set_string(&sql, buf);

for (i = 1; i < ncols_out; i++) {
sprintf(buf, ", %s %s", col_info[i].name, col_info[i].type);
sprintf(buf, ", \"%s\" %s", col_info[i].name, col_info[i].type);
db_append_string(&sql, buf);
}

Expand Down

0 comments on commit 86e988f

Please sign in to comment.