[GRASS-SVN] r31601 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 1 09:01:08 EDT 2008


Author: hamish
Date: 2008-06-01 09:01:08 -0400 (Sun, 01 Jun 2008)
New Revision: 31601

Modified:
   grass/trunk/lib/init/gis_set.tcl
   grass/trunk/lib/init/mke_mapset.c
Log:
more default db -> sqlite

Modified: grass/trunk/lib/init/gis_set.tcl
===================================================================
--- grass/trunk/lib/init/gis_set.tcl	2008-06-01 10:06:54 UTC (rev 31600)
+++ grass/trunk/lib/init/gis_set.tcl	2008-06-01 13:01:08 UTC (rev 31601)
@@ -392,11 +392,11 @@
                     } else {
                     #generate default DB definition, create dbf subdirectory:
                     set varfp [open $mymapset/VAR "w"]
-                    puts $varfp "DB_DRIVER: dbf"
-                    puts $varfp "DB_DATABASE: \$GISDBASE/\$LOCATION_NAME/\$MAPSET/dbf/"
+                    puts $varfp "DB_DRIVER: sqlite"
+                    puts $varfp "DB_DATABASE: \$GISDBASE/\$LOCATION_NAME/\$MAPSET/sqlite.db"
                     close $varfp
                     catch {file attributes $mymapset/VAR -permissions u+rw,go+r}
-                    file mkdir $mymapset/dbf
+#                    file mkdir $mymapset/dbf
                     #copy over the WIND definition:
                     catch {file copy $mymapset/../PERMANENT/DEFAULT_WIND $mymapset/WIND}
                     catch {file attributes $mymapset/WIND -permissions u+rw,go+r}

Modified: grass/trunk/lib/init/mke_mapset.c
===================================================================
--- grass/trunk/lib/init/mke_mapset.c	2008-06-01 10:06:54 UTC (rev 31600)
+++ grass/trunk/lib/init/mke_mapset.c	2008-06-01 13:01:08 UTC (rev 31601)
@@ -31,15 +31,22 @@
 		perror("fopen");
 		G_fatal_error("Cannot create <%s> file in new mapset", buffer2);
 	}
-	fprintf (fd, "DB_DRIVER: dbf\n");
-	fprintf (fd, "DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n");
+	/* Use DB_DEFAULT_DRIVER from <grass/dbmi.h> instead of hardcoding? */
+	fprintf (fd, "DB_DRIVER: sqlite\n");
+	fprintf (fd, "DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db\n");
 	fclose (fd);
 	G_free(buffer2);
-	
+
+#ifdef KEEP_IF_DB_PER_MAP
+/* create similar dir structure for SQLite if a db file is to be
+   created for every vector map instead of one DB per mapset */
+	if(strcmp(DB_DEFAULT_DRIVER, "dbf") == 0 ) {
 /* Make the dbf/ subdirectory */
-	sprintf( buffer, "%s/%s/dbf", location, mapset );
-	if( G_mkdir( buffer ) != 0 )
+	    sprintf( buffer, "%s/%s/dbf", location, mapset );
+	    if( G_mkdir( buffer ) != 0 )
 		return -1;
+	}
+#endif
 
 	return(0) ;
 }



More information about the grass-commit mailing list