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
Родитель e25a1a4409
Коммит fea0d344af
1 изменённых файлов: 6 добавлений и 16 удалений

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

@ -113,14 +113,10 @@ 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_SCHEMA && nRetries != 0) || if (srv != SQLITE_OK) {
(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()));
@ -128,12 +124,6 @@ mozStorageStatement::Initialize(mozStorageConnection *aDBConnection,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (srv == SQLITE_OK)
break;
nRetries++;
}
mDBConnection = aDBConnection; mDBConnection = aDBConnection;
mParamCount = sqlite3_bind_parameter_count (mDBStatement); mParamCount = sqlite3_bind_parameter_count (mDBStatement);
mResultColumnCount = sqlite3_column_count (mDBStatement); mResultColumnCount = sqlite3_column_count (mDBStatement);