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:
Shawn Wilsher 2008-08-29 17:17:01 -04:00
Родитель 8fe0cee11b
Коммит cfba414480
1 изменённых файлов: 6 добавлений и 16 удалений

Просмотреть файл

@ -113,25 +113,15 @@ mozStorageStatement::Initialize(mozStorageConnection *aDBConnection,
sqlite3 *db = aDBConnection->GetNativeConnection();
NS_ENSURE_TRUE(db != nsnull, NS_ERROR_NULL_POINTER);
int nRetries = 0;
int srv;
while (nRetries < 2) {
srv = sqlite3_prepare_v2(db, nsPromiseFlatCString(aSQLStatement).get(),
aSQLStatement.Length(), &mDBStatement, NULL);
if ((srv == SQLITE_SCHEMA && nRetries != 0) ||
(srv != SQLITE_SCHEMA && srv != SQLITE_OK))
{
srv = sqlite3_prepare_v2(db, nsPromiseFlatCString(aSQLStatement).get(),
aSQLStatement.Length(), &mDBStatement, NULL);
if (srv != SQLITE_OK) {
#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, ("Statement was: '%s'", nsPromiseFlatCString(aSQLStatement).get()));
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()));
#endif
return NS_ERROR_FAILURE;
}
if (srv == SQLITE_OK)
break;
nRetries++;
return NS_ERROR_FAILURE;
}
mDBConnection = aDBConnection;