Bug 448114 - Notify about non-finalized statements in debug builds

r=asuth
This commit is contained in:
Shawn Wilsher 2008-12-08 17:14:14 -05:00
parent b8b3d6e66b
commit 122bf532ee
2 changed files with 13 additions and 1 deletions

View File

@ -114,6 +114,7 @@ EXPORTS
sqlite3_mutex_leave
sqlite3_mutex_try
sqlite3_mprintf
sqlite3_next_stmt
sqlite3_open
sqlite3_open_v2
sqlite3_open16

View File

@ -240,6 +240,17 @@ mozStorageConnection::Close()
}
}
#ifdef DEBUG
// Notify about any non-finalized statements.
sqlite3_stmt *stmt = NULL;
while (stmt = sqlite3_next_stmt(mDBConn, stmt)) {
char *msg = PR_smprintf("SQL statement '%s' was not finalized",
sqlite3_sql(stmt));
NS_WARNING(msg);
PR_smprintf_free(msg);
}
#endif
{
nsAutoLock mutex(mProgressHandlerMutex);
if (mProgressHandler)
@ -248,7 +259,7 @@ mozStorageConnection::Close()
int srv = sqlite3_close(mDBConn);
if (srv != SQLITE_OK)
NS_WARNING("sqlite3_close failed. There are probably outstanding statements!");
NS_WARNING("sqlite3_close failed. There are probably outstanding statements that are listed above!");
mDBConn = NULL;
return ConvertResultCode(srv);