summaryrefslogtreecommitdiff
path: root/src/modules/database
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-25 15:18:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-25 15:18:32 +0000
commit5601fd2eff111df01ad4526215ce45fb3b3b6a6e (patch)
treebe731fd2eb820abc702d8ca4d6d36b233d7e88a6 /src/modules/database
parent95825760ed661034d5f7a6d635287944528b0cda (diff)
fix for the automatic database creation
git-svn-id: http://svn.miranda-ng.org/main/trunk@3281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/database')
-rw-r--r--src/modules/database/database.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp
index ae7bf05764..b55a46ac3e 100644
--- a/src/modules/database/database.cpp
+++ b/src/modules/database/database.cpp
@@ -389,16 +389,16 @@ int makeDatabase(TCHAR *profile, DATABASELINK * link, HWND hwndDlg)
}
// enumerate all plugins that had valid DatabasePluginInfo()
-int tryOpenDatabase(const TCHAR* tszProfile)
+int tryOpenDatabase(const TCHAR *tszProfile)
{
for (int i=arDbPlugins.getCount()-1; i >= 0; i--) {
- DATABASELINK* p = arDbPlugins[i];
+ DATABASELINK *p = arDbPlugins[i];
// liked the profile?
int err = p->grokHeader(tszProfile);
if (err == ERROR_SUCCESS) {
// added APIs?
- MIDatabase* pDb = p->Load(tszProfile);
+ MIDatabase *pDb = p->Load(tszProfile);
if (pDb) {
fillProfileName(tszProfile);
currDblink = p;
@@ -434,8 +434,11 @@ static int tryCreateDatabase(const TCHAR* ptszProfile)
int err = p->makeDatabase(tszProfile);
if (err == ERROR_SUCCESS) {
- if ( !p->Load(tszProfile)) {
+ MIDatabase *pDb = p->Load(tszProfile);
+ if (pDb != NULL) {
fillProfileName(tszProfile);
+ currDblink = p;
+ db_setCurrent(currDb = pDb);
return 0;
}
return 1;
@@ -522,7 +525,8 @@ int LoadDatabaseModule(void)
retry = MessageBox(0, buf, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY;
}
}
- } while (retry);
+ }
+ while (retry);
if (rc == ERROR_SUCCESS) {
InitIni();