diff --git a/toolkit/components/places/src/nsNavBookmarks.cpp b/toolkit/components/places/src/nsNavBookmarks.cpp index f9a109740e26..c58357d22eaf 100644 --- a/toolkit/components/places/src/nsNavBookmarks.cpp +++ b/toolkit/components/places/src/nsNavBookmarks.cpp @@ -267,6 +267,10 @@ nsNavBookmarks::GetStatement(const nsCOMPtr& aStmt) "SELECT COUNT(*), " "(SELECT id FROM moz_bookmarks WHERE id = ?1) " "FROM moz_bookmarks WHERE parent = ?1")); + + RETURN_IF_STMT(mDBGetItemIndex, NS_LITERAL_CSTRING( + "SELECT position FROM moz_bookmarks WHERE id = ?1")); + RETURN_IF_STMT(mDBGetChildAt, NS_LITERAL_CSTRING( "SELECT id, fk, type FROM moz_bookmarks " "WHERE parent = ?1 AND position = ?2")); @@ -441,6 +445,7 @@ nsNavBookmarks::FinalizeStatements() { mDBGetChildren, mDBFindURIBookmarks, mDBFolderCount, + mDBGetItemIndex, mDBGetChildAt, mDBGetItemProperties, mDBGetItemIdForGUID, @@ -2863,7 +2868,7 @@ nsNavBookmarks::GetItemIndex(PRInt64 aItemId, PRInt32* _index) *_index = -1; - DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties); + DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemIndex); nsresult rv = stmt->BindInt64Parameter(0, aItemId); NS_ENSURE_SUCCESS(rv, rv); PRBool hasResult; @@ -2872,7 +2877,7 @@ nsNavBookmarks::GetItemIndex(PRInt64 aItemId, PRInt32* _index) if (!hasResult) return NS_OK; - rv = stmt->GetInt32(kGetItemPropertiesIndex_Position, _index); + rv = stmt->GetInt32(0, _index); NS_ENSURE_SUCCESS(rv, rv); return NS_OK;