[GRASS-SVN] r40569 - grass/branches/develbranch_6/lib/db/dbmi_client
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 20 04:02:58 EST 2010
Author: mmetz
Date: 2010-01-20 04:02:57 -0500 (Wed, 20 Jan 2010)
New Revision: 40569
Modified:
grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c
grass/branches/develbranch_6/lib/db/dbmi_client/select.c
Log:
improved error handling, fix for trac #461, backport from relbr6 r40568
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c 2010-01-20 08:58:39 UTC (rev 40568)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c 2010-01-20 09:02:57 UTC (rev 40569)
@@ -249,7 +249,7 @@
if (db_create_table(to_driver, out_table) != DB_OK) {
G_warning(_("Unable to create table <%s>"),
- out_table);
+ to_tblname);
db_close_database_shutdown_driver(to_driver);
if (from_driver != to_driver) {
db_close_database_shutdown_driver(from_driver);
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/select.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/select.c 2010-01-20 08:58:39 UTC (rev 40568)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/select.c 2010-01-20 09:02:57 UTC (rev 40569)
@@ -115,6 +115,11 @@
G_debug(3, "db_select_int()");
+ if (col == NULL || strlen(col) == 0) {
+ G_warning(_("Missing column name"));
+ return -1;
+ }
+
/* allocate */
alloc = 1000;
val = (int *)G_malloc(alloc * sizeof(int));
@@ -203,6 +208,16 @@
dbValue *value;
dbTable *table;
+ if (key == NULL || strlen(key) == 0) {
+ G_warning(_("Missing key column name"));
+ return -1;
+ }
+
+ if (col == NULL || strlen(col) == 0) {
+ G_warning(_("Missing column name"));
+ return -1;
+ }
+
G_zero(val, sizeof(dbValue));
sprintf(buf, "SELECT %s FROM %s WHERE %s = %d\n", col, tab, key, id);
db_init_string(&stmt);
@@ -259,6 +274,16 @@
G_debug(3, "db_select_db_select_CatValArray ()");
+ if (key == NULL || strlen(key) == 0) {
+ G_warning(_("Missing key column name"));
+ return -1;
+ }
+
+ if (col == NULL || strlen(col) == 0) {
+ G_warning(_("Missing column name"));
+ return -1;
+ }
+
db_init_string(&stmt);
sprintf(buf, "SELECT %s, %s FROM %s", key, col, tab);
More information about the grass-commit
mailing list