1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

Bug 2700 - "Failed to open the project database"

Only information gathering changes...not a fix
This commit is contained in:
Leland Lucius
2021-03-27 14:26:30 -05:00
parent 6908d37a90
commit 125114cfe7
3 changed files with 23 additions and 7 deletions

View File

@@ -65,6 +65,10 @@ bool DBConnection::ShouldBypass()
void DBConnection::SetError( void DBConnection::SetError(
const TranslatableString &msg, const TranslatableString &libraryError) const TranslatableString &msg, const TranslatableString &libraryError)
{ {
wxLogMessage(wxT("Connection msg: %s"), msg.Debug());
if (!libraryError.empty())
wxLogMessage(wxT("Connection error: %s"), libraryError.Debug());
mpErrors->mLastError = msg; mpErrors->mLastError = msg;
mpErrors->mLibraryError = libraryError; mpErrors->mLibraryError = libraryError;
} }
@@ -73,12 +77,12 @@ void DBConnection::SetDBError(
const TranslatableString &msg, const TranslatableString &libraryError) const TranslatableString &msg, const TranslatableString &libraryError)
{ {
mpErrors->mLastError = msg; mpErrors->mLastError = msg;
wxLogDebug(wxT("SQLite error: %s"), mpErrors->mLastError.Debug()); wxLogMessage(wxT("SQLite error: %s"), mpErrors->mLastError.Debug());
printf(" Lib error: %s", mpErrors->mLastError.Debug().mb_str().data()); printf("SQLite error: %s", mpErrors->mLastError.Debug().mb_str().data());
mpErrors->mLibraryError = libraryError.empty() mpErrors->mLibraryError = libraryError.empty()
? Verbatim(sqlite3_errmsg(DB())) : libraryError; ? Verbatim(sqlite3_errmsg(DB())) : libraryError;
wxLogDebug(wxT(" Lib error: %s"), mpErrors->mLibraryError.Debug()); wxLogMessage(wxT(" Lib error: %s"), mpErrors->mLibraryError.Debug());
printf(" Lib error: %s", mpErrors->mLibraryError.Debug().mb_str().data()); printf(" Lib error: %s", mpErrors->mLibraryError.Debug().mb_str().data());
} }
@@ -271,7 +275,7 @@ sqlite3_stmt *DBConnection::Prepare(enum StatementID id, const char *sql)
rc = sqlite3_prepare_v3(mDB, sql, -1, SQLITE_PREPARE_PERSISTENT, &stmt, 0); rc = sqlite3_prepare_v3(mDB, sql, -1, SQLITE_PREPARE_PERSISTENT, &stmt, 0);
if (rc != SQLITE_OK) if (rc != SQLITE_OK)
{ {
wxLogDebug("prepare error %s", sqlite3_errmsg(mDB)); wxLogMessage("prepare error %s", sqlite3_errmsg(mDB));
THROW_INCONSISTENCY_EXCEPTION; THROW_INCONSISTENCY_EXCEPTION;
} }

View File

@@ -166,10 +166,13 @@ public:
{ {
// Enable URI filenames for all connections // Enable URI filenames for all connections
mRc = sqlite3_config(SQLITE_CONFIG_URI, 1); mRc = sqlite3_config(SQLITE_CONFIG_URI, 1);
if (mRc == SQLITE_OK) if (mRc == SQLITE_OK)
{ {
mRc = sqlite3_initialize(); mRc = sqlite3_config(SQLITE_CONFIG_LOG, LogCallback, nullptr);
if (mRc == SQLITE_OK)
{
mRc = sqlite3_initialize();
}
} }
#ifdef NO_SHM #ifdef NO_SHM
@@ -193,6 +196,12 @@ public:
// It returns a value, but there's nothing we can do with it // It returns a value, but there's nothing we can do with it
(void) sqlite3_shutdown(); (void) sqlite3_shutdown();
} }
static void LogCallback(void *WXUNUSED(arg), int code, const char *msg)
{
wxLogMessage("sqlite3 message: (%d) %s", code, msg);
}
int mRc; int mRc;
}; };
@@ -356,6 +365,9 @@ bool ProjectFileIO::OpenConnection(FilePath fileName /* = {} */)
mProject.shared_from_this(), mpErrors, [this]{ OnCheckpointFailure(); } ); mProject.shared_from_this(), mpErrors, [this]{ OnCheckpointFailure(); } );
if (!curConn->Open(fileName)) if (!curConn->Open(fileName))
{ {
SetDBError(
XO("Failed to open database file:\n\n%s").Format(fileName)
);
curConn.reset(); curConn.reset();
return false; return false;
} }

View File

@@ -341,7 +341,7 @@ DBConnection *SqliteSampleBlock::Conn() const
if (!pConnection) { if (!pConnection) {
throw SimpleMessageBoxException throw SimpleMessageBoxException
{ {
XO("Failed to open the project's database"), XO("Connection to project file is null"),
XO("Warning"), XO("Warning"),
"Error:_Disk_full_or_not_writable" "Error:_Disk_full_or_not_writable"
}; };