Bug 386368 - Use getters and setters for database schema version. r=sspitzer

This commit is contained in:
sdwilsh@shawnwilsher.com 2007-07-02 10:25:41 -07:00
parent dd606dc17d
commit 9091040e12

View File

@ -521,18 +521,8 @@ nsNavHistory::InitDB(PRBool *aDoImport)
// Get the places schema version, which we store in the user_version PRAGMA
PRInt32 DBSchemaVersion;
{
nsCOMPtr<mozIStorageStatement> statement;
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING("PRAGMA user_version"),
getter_AddRefs(statement));
NS_ENSURE_SUCCESS(rv, rv);
PRBool hasResult;
rv = statement->ExecuteStep(&hasResult);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(hasResult, NS_ERROR_FAILURE);
DBSchemaVersion = statement->AsInt32(0);
}
rv = mDBConn->GetSchemaVersion(&DBSchemaVersion);
NS_ENSURE_SUCCESS(rv, rv);
if (PLACES_SCHEMA_VERSION != DBSchemaVersion) {
// Migration How-to:
@ -711,9 +701,7 @@ nsNavHistory::InitDB(PRBool *aDoImport)
nsresult
nsNavHistory::UpdateSchemaVersion()
{
nsCAutoString schemaVersionPragma("PRAGMA user_version=");
schemaVersionPragma.AppendInt(PLACES_SCHEMA_VERSION);
return mDBConn->ExecuteSimpleSQL(schemaVersionPragma);
return mDBConn->SetSchemaVersion(PLACES_SCHEMA_VERSION);
}
// nsNavHistory::InitStatements