Bug 645093 - Stop using [deprecated] Storage methods in the URL Classifier.
authorShawn Wilsher <me@shawnwilsher.com>
Thu, 31 Mar 2011 10:19:31 -0700
changeset 64474 1a80cec872cf8aae301116dcce183968008cd8a1
parent 64473 895f19f88c975b85704a5d53f6e7293c9bb9cc3d
child 64475 a76f473d9f9933044c828404d4fb17459a8f2a3e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs645093
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 645093 - Stop using [deprecated] Storage methods in the URL Classifier. r=dcamp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -631,49 +631,49 @@ nsUrlClassifierStore::ReadStatement(mozI
 
 nsresult
 nsUrlClassifierStore::BindStatement(const nsUrlClassifierEntry &entry,
                                     mozIStorageStatement* statement)
 {
   nsresult rv;
 
   if (entry.mId == -1)
-    rv = statement->BindNullParameter(0);
+    rv = statement->BindNullByIndex(0);
   else
-    rv = statement->BindInt64Parameter(0, entry.mId);
+    rv = statement->BindInt64ByIndex(0, entry.mId);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = statement->BindBlobParameter(1, entry.mKey.buf, DOMAIN_LENGTH);
+  rv = statement->BindBlobByIndex(1, entry.mKey.buf, DOMAIN_LENGTH);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (entry.mHavePartial) {
     // If we only have a partial entry and that entry matches the domain,
     // we'll save some space by only storing the domain hash.
     if (!entry.mHaveComplete && entry.mKey == entry.mPartialHash) {
-      rv = statement->BindNullParameter(2);
+      rv = statement->BindNullByIndex(2);
     } else {
-      rv = statement->BindBlobParameter(2, entry.mPartialHash.buf,
+      rv = statement->BindBlobByIndex(2, entry.mPartialHash.buf,
                                         PARTIAL_LENGTH);
     }
   } else {
-    rv = statement->BindNullParameter(2);
+    rv = statement->BindNullByIndex(2);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (entry.mHaveComplete) {
-    rv = statement->BindBlobParameter(3, entry.mCompleteHash.buf, COMPLETE_LENGTH);
+    rv = statement->BindBlobByIndex(3, entry.mCompleteHash.buf, COMPLETE_LENGTH);
   } else {
-    rv = statement->BindNullParameter(3);
+    rv = statement->BindNullByIndex(3);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = statement->BindInt32Parameter(4, entry.mChunkId);
+  rv = statement->BindInt32ByIndex(4, entry.mChunkId);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = statement->BindInt32Parameter(5, entry.mTableId);
+  rv = statement->BindInt32ByIndex(5, entry.mTableId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return PR_TRUE;
 }
 
 nsresult
 nsUrlClassifierStore::ReadEntries(mozIStorageStatement *statement,
                                   nsTArray<nsUrlClassifierEntry>& entries)
@@ -701,17 +701,17 @@ nsresult
 nsUrlClassifierStore::ReadEntry(PRInt64 id,
                                 nsUrlClassifierEntry& entry,
                                 PRBool *exists)
 {
   entry.Clear();
 
   mozStorageStatementScoper scoper(mLookupWithIDStatement);
 
-  nsresult rv = mLookupWithIDStatement->BindInt64Parameter(0, id);
+  nsresult rv = mLookupWithIDStatement->BindInt64ByIndex(0, id);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mLookupWithIDStatement->ExecuteStep(exists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (*exists) {
     if (ReadStatement(mLookupWithIDStatement, entry))
       return NS_ERROR_FAILURE;
@@ -729,20 +729,20 @@ nsUrlClassifierStore::ReadNoiseEntries(P
   if (numRequested == 0) {
     return NS_OK;
   }
 
   mozIStorageStatement *statement =
     before ? mPartialEntriesBeforeStatement : mPartialEntriesAfterStatement;
   mozStorageStatementScoper scoper(statement);
 
-  nsresult rv = statement->BindInt64Parameter(0, rowID);
+  nsresult rv = statement->BindInt64ByIndex(0, rowID);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  statement->BindInt32Parameter(1, numRequested);
+  statement->BindInt32ByIndex(1, numRequested);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRUint32 length = entries.Length();
   rv = ReadEntries(statement, entries);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRUint32 numRead = entries.Length() - length;
 
@@ -751,17 +751,17 @@ nsUrlClassifierStore::ReadNoiseEntries(P
 
   // If we didn't get enough entries, we need the search to wrap around from
   // beginning to end (or vice-versa)
 
   mozIStorageStatement *wraparoundStatement =
     before ? mPartialEntriesStatement : mLastPartialEntriesStatement;
   mozStorageStatementScoper wraparoundScoper(wraparoundStatement);
 
-  rv = wraparoundStatement->BindInt32Parameter(0, numRequested - numRead);
+  rv = wraparoundStatement->BindInt32ByIndex(0, numRequested - numRead);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return ReadEntries(wraparoundStatement, entries);
 }
 
 nsresult
 nsUrlClassifierStore::RandomNumber(PRInt64 *randomNum)
 {
@@ -858,35 +858,35 @@ nsUrlClassifierAddStore::Close()
 nsresult
 nsUrlClassifierAddStore::ReadAddEntries(const nsUrlClassifierDomainHash& hash,
                                         PRUint32 tableId,
                                         PRUint32 chunkId,
                                         nsTArray<nsUrlClassifierEntry>& entries)
 {
   mozStorageStatementScoper scoper(mLookupWithChunkStatement);
 
-  nsresult rv = mLookupWithChunkStatement->BindBlobParameter
+  nsresult rv = mLookupWithChunkStatement->BindBlobByIndex
                   (0, hash.buf, DOMAIN_LENGTH);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mLookupWithChunkStatement->BindInt32Parameter(1, tableId);
+  rv = mLookupWithChunkStatement->BindInt32ByIndex(1, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = mLookupWithChunkStatement->BindInt32Parameter(2, chunkId);
+  rv = mLookupWithChunkStatement->BindInt32ByIndex(2, chunkId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return ReadEntries(mLookupWithChunkStatement, entries);
 }
 
 nsresult
 nsUrlClassifierAddStore::ReadAddEntries(const nsUrlClassifierDomainHash& hash,
                                         nsTArray<nsUrlClassifierEntry>& entries)
 {
   mozStorageStatementScoper scoper(mLookupStatement);
 
-  nsresult rv = mLookupStatement->BindBlobParameter
+  nsresult rv = mLookupStatement->BindBlobByIndex
                   (0, hash.buf, DOMAIN_LENGTH);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return ReadEntries(mLookupStatement, entries);
 }
 
 // -------------------------------------------------------------------------
 // nsUrlClassifierSubStore class implementation
@@ -975,41 +975,41 @@ nsUrlClassifierSubStore::ReadStatement(m
 
 nsresult
 nsUrlClassifierSubStore::BindStatement(const nsUrlClassifierEntry& entry,
                                        mozIStorageStatement* statement)
 {
   nsresult rv = nsUrlClassifierStore::BindStatement(entry, statement);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return statement->BindInt32Parameter(6, entry.mAddChunkId);
+  return statement->BindInt32ByIndex(6, entry.mAddChunkId);
 }
 
 nsresult
 nsUrlClassifierSubStore::ReadSubEntries(PRUint32 tableId, PRUint32 addChunkId,
                                         nsTArray<nsUrlClassifierEntry>& entries)
 {
   mozStorageStatementScoper scoper(mLookupWithAddChunkStatement);
 
-  nsresult rv = mLookupWithAddChunkStatement->BindInt32Parameter(0, tableId);
+  nsresult rv = mLookupWithAddChunkStatement->BindInt32ByIndex(0, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = mLookupWithAddChunkStatement->BindInt32Parameter(1, addChunkId);
+  rv = mLookupWithAddChunkStatement->BindInt32ByIndex(1, addChunkId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return ReadEntries(mLookupWithAddChunkStatement, entries);
 }
 
 nsresult
 nsUrlClassifierSubStore::ExpireAddChunk(PRUint32 tableId, PRUint32 addChunkId)
 {
   mozStorageStatementScoper scoper(mExpireAddChunkStatement);
 
-  nsresult rv = mExpireAddChunkStatement->BindInt32Parameter(0, tableId);
+  nsresult rv = mExpireAddChunkStatement->BindInt32ByIndex(0, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = mExpireAddChunkStatement->BindInt32Parameter(1, addChunkId);
+  rv = mExpireAddChunkStatement->BindInt32ByIndex(1, addChunkId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return mExpireAddChunkStatement->Execute();
 }
 
 void
 nsUrlClassifierSubStore::Close()
 {
@@ -1858,29 +1858,29 @@ nsUrlClassifierDBServiceWorker::GetTable
 }
 
 nsresult
 nsUrlClassifierDBServiceWorker::GetTableId(const nsACString& table,
                                            PRUint32* tableId)
 {
   mozStorageStatementScoper findScoper(mGetTableIdStatement);
 
-  nsresult rv = mGetTableIdStatement->BindUTF8StringParameter(0, table);
+  nsresult rv = mGetTableIdStatement->BindUTF8StringByIndex(0, table);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRBool exists;
   rv = mGetTableIdStatement->ExecuteStep(&exists);
   NS_ENSURE_SUCCESS(rv, rv);
   if (exists) {
     *tableId = mGetTableIdStatement->AsInt32(0);
     return NS_OK;
   }
 
   mozStorageStatementScoper insertScoper(mInsertTableIdStatement);
-  rv = mInsertTableIdStatement->BindUTF8StringParameter(0, table);
+  rv = mInsertTableIdStatement->BindUTF8StringByIndex(0, table);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mInsertTableIdStatement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt64 rowId;
   rv = mConnection->GetLastInsertRowID(&rowId);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1893,17 +1893,17 @@ nsUrlClassifierDBServiceWorker::GetTable
   return NS_OK;
 }
 
 nsresult
 nsUrlClassifierDBServiceWorker::GetTableName(PRUint32 tableId,
                                              nsACString& tableName)
 {
   mozStorageStatementScoper findScoper(mGetTableNameStatement);
-  nsresult rv = mGetTableNameStatement->BindInt32Parameter(0, tableId);
+  nsresult rv = mGetTableNameStatement->BindInt32ByIndex(0, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRBool exists;
   rv = mGetTableNameStatement->ExecuteStep(&exists);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!exists) return NS_ERROR_FAILURE;
 
   return mGetTableNameStatement->GetUTF8String(0, tableName);
@@ -1953,17 +1953,17 @@ nsUrlClassifierDBServiceWorker::InflateC
 nsresult
 nsUrlClassifierStore::DeleteEntry(nsUrlClassifierEntry& entry)
 {
   if (entry.mId == -1) {
     return NS_OK;
   }
 
   mozStorageStatementScoper scoper(mDeleteStatement);
-  mDeleteStatement->BindInt64Parameter(0, entry.mId);
+  mDeleteStatement->BindInt64ByIndex(0, entry.mId);
   nsresult rv = mDeleteStatement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   entry.mId = -1;
 
   return NS_OK;
 }
 
@@ -2392,17 +2392,17 @@ nsUrlClassifierDBServiceWorker::GetChunk
                                               nsACString& addChunks,
                                               nsACString& subChunks)
 {
   addChunks.Truncate();
   subChunks.Truncate();
 
   mozStorageStatementScoper scoper(mGetChunkListsStatement);
 
-  nsresult rv = mGetChunkListsStatement->BindInt32Parameter(0, tableId);
+  nsresult rv = mGetChunkListsStatement->BindInt32ByIndex(0, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRBool hasMore = PR_FALSE;
   rv = mGetChunkListsStatement->ExecuteStep(&hasMore);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!hasMore) {
     LOG(("Getting chunks for %d, found nothing", tableId));
@@ -2425,19 +2425,19 @@ nsUrlClassifierDBServiceWorker::GetChunk
 
 nsresult
 nsUrlClassifierDBServiceWorker::SetChunkLists(PRUint32 tableId,
                                               const nsACString& addChunks,
                                               const nsACString& subChunks)
 {
   mozStorageStatementScoper scoper(mSetChunkListsStatement);
 
-  mSetChunkListsStatement->BindUTF8StringParameter(0, addChunks);
-  mSetChunkListsStatement->BindUTF8StringParameter(1, subChunks);
-  mSetChunkListsStatement->BindInt32Parameter(2, tableId);
+  mSetChunkListsStatement->BindUTF8StringByIndex(0, addChunks);
+  mSetChunkListsStatement->BindUTF8StringByIndex(1, subChunks);
+  mSetChunkListsStatement->BindInt32ByIndex(2, tableId);
   nsresult rv = mSetChunkListsStatement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsresult
 nsUrlClassifierDBServiceWorker::CacheChunkLists(PRUint32 tableId,
@@ -2597,19 +2597,19 @@ nsUrlClassifierDBServiceWorker::AddChunk
 
 nsresult
 nsUrlClassifierStore::Expire(PRUint32 tableId, PRUint32 chunkNum)
 {
   LOG(("Expiring chunk %d\n", chunkNum));
 
   mozStorageStatementScoper expireScoper(mExpireStatement);
 
-  nsresult rv = mExpireStatement->BindInt32Parameter(0, tableId);
+  nsresult rv = mExpireStatement->BindInt32ByIndex(0, tableId);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = mExpireStatement->BindInt32Parameter(1, chunkNum);
+  rv = mExpireStatement->BindInt32ByIndex(1, chunkNum);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mWorker->HandlePendingLookups();
 
   rv = mExpireStatement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;