[GRASS-SVN] r36620 - grass/branches/develbranch_6/vector/v.in.dxf

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 7 22:43:14 EDT 2009


Author: hcho
Date: 2009-04-07 22:43:14 -0400 (Tue, 07 Apr 2009)
New Revision: 36620

Modified:
   grass/branches/develbranch_6/vector/v.in.dxf/write_vect.c
Log:
Fixed table naming

Modified: grass/branches/develbranch_6/vector/v.in.dxf/write_vect.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.dxf/write_vect.c	2009-04-08 02:41:47 UTC (rev 36619)
+++ grass/branches/develbranch_6/vector/v.in.dxf/write_vect.c	2009-04-08 02:43:14 UTC (rev 36620)
@@ -122,9 +122,18 @@
 			 int *cat)
 {
     int i, type;
+    char x = 0;
 
-    /* make table name SQL compliant */
+    /* make table name SQL compliant: Vect_default_field_info returns
+     * mapname_layername in ->table, and mapname is always SQL compliant.
+     * Because layername is followed by mapname_, it (field_name here) can
+     * start with [a-zA-Z0-9]. No need to change the first digit to 'x'.
+     */
+    if (field_name[0] >= '0' && field_name[0] <= '9')
+	x = field_name[0];
     G_str_to_sql(field_name);
+    if (x)
+        field_name[0] = x;
 
     for (i = 0; i < num_fields; i++) {
 	/* field name already exists */



More information about the grass-commit mailing list