[GRASS-SVN] r53600 - grass/trunk/db/drivers/sqlite
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 28 11:24:48 PDT 2012
Author: martinl
Date: 2012-10-28 11:24:48 -0700 (Sun, 28 Oct 2012)
New Revision: 53600
Modified:
grass/trunk/db/drivers/sqlite/listdb.c
Log:
SQLite DB driver: list_databases() - check full path to the DB file
Modified: grass/trunk/db/drivers/sqlite/listdb.c
===================================================================
--- grass/trunk/db/drivers/sqlite/listdb.c 2012-10-28 18:16:07 UTC (rev 53599)
+++ grass/trunk/db/drivers/sqlite/listdb.c 2012-10-28 18:24:48 UTC (rev 53600)
@@ -106,19 +106,22 @@
continue;
len = strlen(dp->d_name) - 3;
/* try to open file as SQLite database */
- if (len > 0 &&
- G_strcasecmp(dp->d_name + len, ".db") == 0 &&
- sqlite3_open(dp->d_name, &sqlite) == SQLITE_OK) {
-
- if (sqlite3_close(sqlite) == SQLITE_BUSY) {
- db_d_append_error(_("SQLite database connection '%s' is still busy"),
- dp->d_name);
- continue;
+ if (len > 0 && G_strcasecmp(dp->d_name + len, ".db") == 0) {
+ char fpath[GPATH_MAX];
+
+ sprintf(fpath, "%s/%s", db_get_string(path), dp->d_name);
+ if (sqlite3_open(fpath, &sqlite) == SQLITE_OK) {
+ if (sqlite3_close(sqlite) == SQLITE_BUSY) {
+ db_d_append_error(_("SQLite database connection '%s' is still busy"),
+ dp->d_name);
+ continue;
+ }
+
+ hcount++;
+ dlist = (char **) G_realloc(dlist, hcount * sizeof(char *));
+ G_debug(3, "%s", dp->d_name);
+ dlist[hcount-1] = G_store(dp->d_name);
}
- hcount++;
- dlist = (char **) G_realloc(dlist, hcount * sizeof(char *));
- G_debug(3, "%s", dp->d_name);
- dlist[hcount-1] = G_store(dp->d_name);
}
}
G_debug(1, "db count = %d", hcount);
More information about the grass-commit
mailing list