[GB.DB.SQLITE2]

* BUG: Listing databases without specifying the host does not crash 
  anymore.
  
[GB.DB.SQLITE3]
* BUG: Listing databases without specifying the host does not crash 
  anymore.


git-svn-id: svn://localhost/gambas/trunk@7412 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2015-10-16 11:52:39 +00:00
parent da95a37de1
commit c60a05fc9c
2 changed files with 24 additions and 24 deletions

View file

@ -1975,22 +1975,21 @@ static int database_list(DB_DATABASE *db, char ***databases)
/* Hostname contains home area */
dbhome = (char *)conn->getHostName();
WalkDirectory( dbhome, databases );
/* Checks GAMBAS_SQLITE_DBHOME if set, or Current Working Directory */
/* Might have to come back and seperate */
dbhome = GetDatabaseHome();
if (dbhome){
//GB.Error("Unable to get databases: &1", "Can't find current directory");
WalkDirectory( dbhome, databases );
GB.Free(POINTER(&dbhome));
if (dbhome && *dbhome)
{
WalkDirectory( dbhome, databases );
}
/*if (getcwd(cwd, MAX_PATH) != NULL){
if (strcmp(cwd, dbhome) != 0){
WalkDirectory( cwd, databases );
else
{
/* Checks GAMBAS_SQLITE_DBHOME if set, or Current Working Directory */
/* Might have to come back and seperate */
dbhome = GetDatabaseHome();
if (dbhome){
//GB.Error("Unable to get databases: &1", "Can't find current directory");
WalkDirectory( dbhome, databases );
GB.Free(POINTER(&dbhome));
}
}*/
}
return GB.Count(databases);
}

View file

@ -2165,17 +2165,18 @@ static int database_list(DB_DATABASE *db, char ***databases)
GB.NewArray(databases, sizeof(char *), 0);
/* Hostname contains home area */
dbhome = conn->host;
walk_directory(dbhome, databases);
/* Checks GAMBAS_SQLITE_DBHOME if set, or Current Working Directory */
/* Might have to come back and seperate */
dbhome = get_database_home();
if (dbhome)
if (conn->host && *conn->host)
{
//GB.Error("Unable to get databases: &1", "Can't find current directory");
walk_directory(dbhome, databases);
GB.Free(POINTER(&dbhome));
walk_directory(conn->host, databases);
}
else
{
dbhome = get_database_home();
if (dbhome)
{
walk_directory(dbhome, databases);
GB.Free(POINTER(&dbhome));
}
}
return GB.Count(databases);