[GRASS-SVN] r64396 - in grass/trunk/db/drivers: dbf mysql ogr postgres sqlite

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 2 05:34:53 PST 2015


Author: mmetz
Date: 2015-02-02 05:34:52 -0800 (Mon, 02 Feb 2015)
New Revision: 64396

Modified:
   grass/trunk/db/drivers/dbf/db.c
   grass/trunk/db/drivers/dbf/describe.c
   grass/trunk/db/drivers/dbf/table.c
   grass/trunk/db/drivers/mysql/parse.c
   grass/trunk/db/drivers/mysql/replace.c
   grass/trunk/db/drivers/ogr/execute.c
   grass/trunk/db/drivers/postgres/parse.c
   grass/trunk/db/drivers/sqlite/db.c
Log:
db drivers: chop tokens

Modified: grass/trunk/db/drivers/dbf/db.c
===================================================================
--- grass/trunk/db/drivers/dbf/db.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/dbf/db.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -65,6 +65,7 @@
 	db.name[0] = '\0';	/* re-init */
 
 	for (n = 0; n < no_tokens; n++) {
+	    G_chop(tokens[n]);
 	    G_debug(3, "tokens[%d] = %s", n, tokens[n]);
 	    if (tokens[n][0] == '$') {
 		G_strchg(tokens[n], '$', ' ');

Modified: grass/trunk/db/drivers/dbf/describe.c
===================================================================
--- grass/trunk/db/drivers/dbf/describe.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/dbf/describe.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -65,6 +65,9 @@
 	else
 	    col = i;
 
+	precision = 0;
+	scale = 0;
+
 	dcol = &(db.tables[tab].cols[col]);
 	column = db_get_table_column(*table, i);
 

Modified: grass/trunk/db/drivers/dbf/table.c
===================================================================
--- grass/trunk/db/drivers/dbf/table.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/dbf/table.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -259,6 +259,9 @@
 	case DBF_DOUBLE:
 	    dbftype = FTDouble;
 	    break;
+	default:
+	    G_warning("invalid/unsupported DBFFieldType");
+	    break;
 	}
 
 	width = db.tables[t].cols[i].width;

Modified: grass/trunk/db/drivers/mysql/parse.c
===================================================================
--- grass/trunk/db/drivers/mysql/parse.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/mysql/parse.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -49,6 +49,7 @@
 	tokens = G_tokenize(str, delm);
 	i = 0;
 	while (tokens[i]) {
+	    G_chop(tokens[i]);
 	    G_debug(3, "token %d : %s", i, tokens[i]);
 	    if (strncmp(tokens[i], "host", 4) == 0) {
 		conn->host = G_store(tokens[i] + 5);

Modified: grass/trunk/db/drivers/mysql/replace.c
===================================================================
--- grass/trunk/db/drivers/mysql/replace.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/mysql/replace.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -42,6 +42,7 @@
 
 	tmp[0] = '\0';
 	for (n = 0; n < no_tokens - 1; n++) {
+	    G_chop(tokens[n]);
 	    if (n > 0)
 		strcat(tmp, "/");
 

Modified: grass/trunk/db/drivers/ogr/execute.c
===================================================================
--- grass/trunk/db/drivers/ogr/execute.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/ogr/execute.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -181,6 +181,7 @@
     *cols = (column_info *)G_malloc(sizeof(column_info) * (*ncols));
     
     for (n = 0; n < (*ncols); n++) {
+	G_chop(token[n]);
 	itoken = G_tokenize(token[n], "=");
 	if (G_number_of_tokens(itoken) != 2)
 	    return FALSE;

Modified: grass/trunk/db/drivers/postgres/parse.c
===================================================================
--- grass/trunk/db/drivers/postgres/parse.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/postgres/parse.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -44,6 +44,7 @@
 	tokens = G_tokenize(str, delm);
 	i = 0;
 	while (tokens[i]) {
+	    G_chop(tokens[i]);
 	    G_debug(3, "token %d : %s", i, tokens[i]);
 	    if (strncmp(tokens[i], "host", 4) == 0)
 		pgconn->host = G_store(tokens[i] + 5);

Modified: grass/trunk/db/drivers/sqlite/db.c
===================================================================
--- grass/trunk/db/drivers/sqlite/db.c	2015-02-02 13:22:01 UTC (rev 64395)
+++ grass/trunk/db/drivers/sqlite/db.c	2015-02-02 13:34:52 UTC (rev 64396)
@@ -60,6 +60,7 @@
 
 	name2[0] = '\0';
 	for (n = 0; n < no_tokens; n++) {
+	    G_chop(tokens[n]);
 	    if (n > 0)
 		strcat(name2, "/");
 



More information about the grass-commit mailing list