зеркало из https://github.com/mozilla/pjs.git
Bug 452833 - Do not loop if we get SQLITE_SCHEMA
We used to have to try again if we got SQLITE_SCHEMA back from sqlite when we prepare a statement. However, this isn't needed with the new v2 interface, which we now use. r=bholley
This commit is contained in:
Родитель
e25a1a4409
Коммит
fea0d344af
|
@ -113,25 +113,15 @@ mozStorageStatement::Initialize(mozStorageConnection *aDBConnection,
|
||||||
sqlite3 *db = aDBConnection->GetNativeConnection();
|
sqlite3 *db = aDBConnection->GetNativeConnection();
|
||||||
NS_ENSURE_TRUE(db != nsnull, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(db != nsnull, NS_ERROR_NULL_POINTER);
|
||||||
|
|
||||||
int nRetries = 0;
|
|
||||||
int srv;
|
int srv;
|
||||||
while (nRetries < 2) {
|
srv = sqlite3_prepare_v2(db, nsPromiseFlatCString(aSQLStatement).get(),
|
||||||
srv = sqlite3_prepare_v2(db, nsPromiseFlatCString(aSQLStatement).get(),
|
aSQLStatement.Length(), &mDBStatement, NULL);
|
||||||
aSQLStatement.Length(), &mDBStatement, NULL);
|
if (srv != SQLITE_OK) {
|
||||||
if ((srv == SQLITE_SCHEMA && nRetries != 0) ||
|
|
||||||
(srv != SQLITE_SCHEMA && srv != SQLITE_OK))
|
|
||||||
{
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
PR_LOG(gStorageLog, PR_LOG_ERROR, ("Sqlite statement prepare error: %d '%s'", srv, sqlite3_errmsg(db)));
|
PR_LOG(gStorageLog, PR_LOG_ERROR, ("Sqlite statement prepare error: %d '%s'", srv, sqlite3_errmsg(db)));
|
||||||
PR_LOG(gStorageLog, PR_LOG_ERROR, ("Statement was: '%s'", nsPromiseFlatCString(aSQLStatement).get()));
|
PR_LOG(gStorageLog, PR_LOG_ERROR, ("Statement was: '%s'", nsPromiseFlatCString(aSQLStatement).get()));
|
||||||
#endif
|
#endif
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
|
||||||
|
|
||||||
if (srv == SQLITE_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
nRetries++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mDBConnection = aDBConnection;
|
mDBConnection = aDBConnection;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче