Jelajahi Sumber

dblib: sqlite needs exclusive access to the folder with the database

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52829 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 tahun lalu
induk
melakukan
f5c4e9ffc9
1 mengubah file dengan 11 tambahan dan 2 penghapusan
  1. 11 2
      lib/db/dbmi_base/default_name.c

+ 11 - 2
lib/db/dbmi_base/default_name.c

@@ -111,7 +111,7 @@ int db_set_default_connection(void)
 	G__make_mapset_element("dbf");
     }
     else if (strcmp(DB_DEFAULT_DRIVER, "sqlite") == 0) {
-	/* Set default values and create dbf db dir */
+	/* Set default values and create sqlite db dir */
 
 	connection.driverName = "sqlite";
 	/*
@@ -119,8 +119,17 @@ int db_set_default_connection(void)
 	 *      or per-map DBs in $MASPET/vector/mapname/sqlite.db (how to set that here?)
 	 *      or $MAPSET/sqlite/mapname.sql as with dbf?
 	 */
+	 
+	 /* http://www.sqlite.org/lockingv3.html
+	  * When SQLite creates a journal file on Unix, it opens the 
+	  * directory that contains that file and calls fsync() on the 
+	  * directory, in an effort to push the directory information to disk.
+	  * 
+	  * -> have sqlite.db in a separate directory
+	  */
 	connection.databaseName =
-	    "$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db";
+	    "$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db";
+	G__make_mapset_element("sqlite");
 	db_set_connection(&connection);
     }
     else