Skip to content

Commit

Permalink
v.to.db: Require --overwrite flag to overwrite existing columns (#487)
Browse files Browse the repository at this point in the history
This is a very straightforward fix. It updates the manual and implements the overwrite flag as discussed before. I took the liberty of merging it.
  • Loading branch information
HuidaeCho authored and neteler committed Apr 12, 2020
1 parent cf4c8d4 commit 1be7bfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 6 additions & 2 deletions vector/v.to.db/main.c
Expand Up @@ -206,8 +206,12 @@ int main(int argc, char *argv[])
}
}

G_warning(_("Values in column <%s> will be overwritten"),
options.col[col]);
if (G_get_overwrite())
G_warning(_("Values in column <%s> will be overwritten"),
options.col[col]);
else
G_fatal_error(_("Column <%s> exists. To overwrite, use the --overwrite flag"),
options.col[col]);

break;
}
Expand Down
9 changes: 4 additions & 5 deletions vector/v.to.db/v.to.db.html
Expand Up @@ -36,11 +36,10 @@ <h2>NOTES</h2>
doesn't require a table. Use <em><a href="db.execute.html">db.execute</a></em>
or <em><a href="v.db.addtable.html">v.db.addtable</a></em> to create a table if
needed.
<p>Updating the table has to be done column-wise. The <em>column</em> must be
present in the table, except when using the <b>print only</b> (<b>-p</b>)
mode. Use <em><a href="db.execute.html">db.execute</a></em> or
<em><a href="v.db.addcolumn.html">v.db.addcolumn</a></em> to add new columns if
needed.
<p>Updating the table has to be done column-wise. The <em>column</em> will be
created in the table if it doesn't already exist, except when using the
<b>print only</b> (<b>-p</b>) mode. If the <em>column</em> exists, the
<b>--overwrite</b> flag is required to overwrite it.

<h2>EXAMPLES</h2>

Expand Down

0 comments on commit 1be7bfe

Please sign in to comment.