зеркало из https://github.com/mozilla/gecko-dev.git
Bug 555218 - 6: (nsNavBookmarks.cpp) Fix Places usage of deprecated Storage APIs. r=dietrich
This commit is contained in:
Родитель
d5f9ccc641
Коммит
a65c9365c7
|
@ -83,15 +83,7 @@ const PRInt32 nsNavBookmarks::kGetItemPropertiesIndex_ServiceContractId = 7;
|
||||||
const PRInt32 nsNavBookmarks::kGetItemPropertiesIndex_DateAdded = 8;
|
const PRInt32 nsNavBookmarks::kGetItemPropertiesIndex_DateAdded = 8;
|
||||||
const PRInt32 nsNavBookmarks::kGetItemPropertiesIndex_LastModified = 9;
|
const PRInt32 nsNavBookmarks::kGetItemPropertiesIndex_LastModified = 9;
|
||||||
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_Id = 0;
|
using namespace mozilla::places;
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_PlaceId = 1;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_Type = 2;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_Parent = 3;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_Position = 4;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_Title = 5;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_ServiceContractId = 6;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_DateAdded = 7;
|
|
||||||
const PRInt32 nsNavBookmarks::kInsertBookmarkIndex_LastModified = 8;
|
|
||||||
|
|
||||||
PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsNavBookmarks, gBookmarksService)
|
PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsNavBookmarks, gBookmarksService)
|
||||||
|
|
||||||
|
@ -231,12 +223,12 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
RETURN_IF_STMT(mDBFindURIBookmarks, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBFindURIBookmarks, NS_LITERAL_CSTRING(
|
||||||
"SELECT b.id "
|
"SELECT b.id "
|
||||||
"FROM moz_bookmarks b "
|
"FROM moz_bookmarks b "
|
||||||
"WHERE b.type = ?2 AND b.fk = ( "
|
"WHERE b.type = :item_type AND b.fk = ( "
|
||||||
"SELECT id FROM moz_places_temp "
|
"SELECT id FROM moz_places_temp "
|
||||||
"WHERE url = ?1 "
|
"WHERE url = :page_url "
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT id FROM moz_places "
|
"SELECT id FROM moz_places "
|
||||||
"WHERE url = ?1 "
|
"WHERE url = :page_url "
|
||||||
"LIMIT 1 "
|
"LIMIT 1 "
|
||||||
") "
|
") "
|
||||||
"ORDER BY b.lastModified DESC, b.id DESC "));
|
"ORDER BY b.lastModified DESC, b.id DESC "));
|
||||||
|
@ -259,17 +251,18 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
"LEFT JOIN moz_places_temp h_t ON b.fk = h_t.id "
|
"LEFT JOIN moz_places_temp h_t ON b.fk = h_t.id "
|
||||||
"LEFT JOIN moz_places h ON b.fk = h.id "
|
"LEFT JOIN moz_places h ON b.fk = h.id "
|
||||||
"LEFT JOIN moz_favicons f ON h.favicon_id = f.id "
|
"LEFT JOIN moz_favicons f ON h.favicon_id = f.id "
|
||||||
"WHERE b.parent = ?1 "
|
"WHERE b.parent = :parent "
|
||||||
"ORDER BY b.position ASC"));
|
"ORDER BY b.position ASC"));
|
||||||
|
|
||||||
// Count all of the children of a given folder and checks that it exists.
|
// Count all of the children of a given folder and checks that it exists.
|
||||||
RETURN_IF_STMT(mDBFolderCount, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBFolderCount, NS_LITERAL_CSTRING(
|
||||||
"SELECT COUNT(*), "
|
"SELECT COUNT(*), "
|
||||||
"(SELECT id FROM moz_bookmarks WHERE id = ?1) "
|
"(SELECT id FROM moz_bookmarks WHERE id = :parent) "
|
||||||
"FROM moz_bookmarks WHERE parent = ?1"));
|
"FROM moz_bookmarks WHERE parent = :parent"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBGetChildAt, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetChildAt, NS_LITERAL_CSTRING(
|
||||||
"SELECT id, fk, type FROM moz_bookmarks "
|
"SELECT id, fk, type FROM moz_bookmarks "
|
||||||
"WHERE parent = ?1 AND position = ?2"));
|
"WHERE parent = :parent AND position = :item_index"));
|
||||||
|
|
||||||
// Get bookmark/folder/separator properties.
|
// Get bookmark/folder/separator properties.
|
||||||
RETURN_IF_STMT(mDBGetItemProperties, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetItemProperties, NS_LITERAL_CSTRING(
|
||||||
|
@ -279,29 +272,30 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
"b.title, b.position, b.fk, b.parent, b.type, b.folder_type, "
|
"b.title, b.position, b.fk, b.parent, b.type, b.folder_type, "
|
||||||
"b.dateAdded, b.lastModified "
|
"b.dateAdded, b.lastModified "
|
||||||
"FROM moz_bookmarks b "
|
"FROM moz_bookmarks b "
|
||||||
"WHERE b.id = ?1"));
|
"WHERE b.id = :item_id"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBGetItemIdForGUID, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetItemIdForGUID, NS_LITERAL_CSTRING(
|
||||||
"SELECT item_id FROM moz_items_annos "
|
"SELECT item_id FROM moz_items_annos "
|
||||||
"WHERE content = ?1 "
|
"WHERE content = :guid "
|
||||||
"LIMIT 1"));
|
"LIMIT 1"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBInsertBookmark, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBInsertBookmark, NS_LITERAL_CSTRING(
|
||||||
"INSERT INTO moz_bookmarks "
|
"INSERT INTO moz_bookmarks "
|
||||||
"(id, fk, type, parent, position, title, folder_type, "
|
"(id, fk, type, parent, position, title, folder_type, "
|
||||||
"dateAdded, lastModified) "
|
"dateAdded, lastModified) "
|
||||||
"VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)"));
|
"VALUES (:item_id, :page_id, :item_type, :parent, :item_index, "
|
||||||
|
":item_title, :folder_type, :date_added, :last_modified)"));
|
||||||
|
|
||||||
// Just select position since it's just an int32 and may be faster.
|
// Just select position since it's just an int32 and may be faster.
|
||||||
// We don't actually care about the data, just whether there is any.
|
// We don't actually care about the data, just whether there is any.
|
||||||
RETURN_IF_STMT(mDBIsBookmarkedInDatabase, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBIsBookmarkedInDatabase, NS_LITERAL_CSTRING(
|
||||||
"SELECT 1 FROM moz_bookmarks WHERE fk = ?1"));
|
"SELECT 1 FROM moz_bookmarks WHERE fk = :page_id"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBIsURIBookmarkedInDatabase, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBIsURIBookmarkedInDatabase, NS_LITERAL_CSTRING(
|
||||||
"SELECT 1 FROM moz_bookmarks WHERE fk = ("
|
"SELECT 1 FROM moz_bookmarks WHERE fk = ("
|
||||||
"SELECT id FROM moz_places_temp WHERE url = ?1 "
|
"SELECT id FROM moz_places_temp WHERE url = :page_url "
|
||||||
"UNION ALL "
|
"UNION ALL "
|
||||||
"SELECT id FROM moz_places WHERE url = ?1 "
|
"SELECT id FROM moz_places WHERE url = :page_url "
|
||||||
"LIMIT 1"
|
"LIMIT 1"
|
||||||
")"));
|
")"));
|
||||||
|
|
||||||
|
@ -309,13 +303,13 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
RETURN_IF_STMT(mDBIsRealBookmark, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBIsRealBookmark, NS_LITERAL_CSTRING(
|
||||||
"SELECT id "
|
"SELECT id "
|
||||||
"FROM moz_bookmarks "
|
"FROM moz_bookmarks "
|
||||||
"WHERE fk = ?1 "
|
"WHERE fk = :page_id "
|
||||||
"AND type = ?2 "
|
"AND type = :item_type "
|
||||||
"AND parent NOT IN ("
|
"AND parent NOT IN ("
|
||||||
"SELECT a.item_id "
|
"SELECT a.item_id "
|
||||||
"FROM moz_items_annos a "
|
"FROM moz_items_annos a "
|
||||||
"JOIN moz_anno_attributes n ON a.anno_attribute_id = n.id "
|
"JOIN moz_anno_attributes n ON a.anno_attribute_id = n.id "
|
||||||
"WHERE n.name = ?3"
|
"WHERE n.name = :anno_name"
|
||||||
") "
|
") "
|
||||||
"LIMIT 1"));
|
"LIMIT 1"));
|
||||||
|
|
||||||
|
@ -329,30 +323,30 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
// performance reasons, since it will allow us to use an index to sort items
|
// performance reasons, since it will allow us to use an index to sort items
|
||||||
// by date.
|
// by date.
|
||||||
RETURN_IF_STMT(mDBSetItemDateAdded, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBSetItemDateAdded, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET dateAdded = ?1, lastModified = ?1 "
|
"UPDATE moz_bookmarks SET dateAdded = :date, lastModified = :date "
|
||||||
"WHERE id = ?2"));
|
"WHERE id = :item_id"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBSetItemLastModified, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBSetItemLastModified, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET lastModified = ?1 WHERE id = ?2"));
|
"UPDATE moz_bookmarks SET lastModified = :date WHERE id = :item_id"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBSetItemIndex, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBSetItemIndex, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET position = ?2 WHERE id = ?1"));
|
"UPDATE moz_bookmarks SET position = :item_index WHERE id = :item_id"));
|
||||||
|
|
||||||
// Get keyword text for bookmark id.
|
// Get keyword text for bookmark id.
|
||||||
RETURN_IF_STMT(mDBGetKeywordForBookmark, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetKeywordForBookmark, NS_LITERAL_CSTRING(
|
||||||
"SELECT k.keyword FROM moz_bookmarks b "
|
"SELECT k.keyword FROM moz_bookmarks b "
|
||||||
"JOIN moz_keywords k ON k.id = b.keyword_id "
|
"JOIN moz_keywords k ON k.id = b.keyword_id "
|
||||||
"WHERE b.id = ?1"));
|
"WHERE b.id = :item_id"));
|
||||||
|
|
||||||
// Get keyword text for bookmarked URI.
|
// Get keyword text for bookmarked URI.
|
||||||
RETURN_IF_STMT(mDBGetKeywordForURI, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetKeywordForURI, NS_LITERAL_CSTRING(
|
||||||
"SELECT k.keyword "
|
"SELECT k.keyword "
|
||||||
"FROM ( "
|
"FROM ( "
|
||||||
"SELECT id FROM moz_places_temp "
|
"SELECT id FROM moz_places_temp "
|
||||||
"WHERE url = ?1 "
|
"WHERE url = :page_url "
|
||||||
"UNION ALL "
|
"UNION ALL "
|
||||||
"SELECT id FROM moz_places "
|
"SELECT id FROM moz_places "
|
||||||
"WHERE url = ?1 "
|
"WHERE url = :page_url "
|
||||||
"LIMIT 1 "
|
"LIMIT 1 "
|
||||||
") AS h "
|
") AS h "
|
||||||
"JOIN moz_bookmarks b ON b.fk = h.id "
|
"JOIN moz_bookmarks b ON b.fk = h.id "
|
||||||
|
@ -363,33 +357,37 @@ nsNavBookmarks::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||||
"SELECT url FROM moz_keywords k "
|
"SELECT url FROM moz_keywords k "
|
||||||
"JOIN moz_bookmarks b ON b.keyword_id = k.id "
|
"JOIN moz_bookmarks b ON b.keyword_id = k.id "
|
||||||
"JOIN moz_places_temp h ON b.fk = h.id "
|
"JOIN moz_places_temp h ON b.fk = h.id "
|
||||||
"WHERE k.keyword = ?1 "
|
"WHERE k.keyword = :keyword "
|
||||||
"UNION ALL "
|
"UNION ALL "
|
||||||
"SELECT url FROM moz_keywords k "
|
"SELECT url FROM moz_keywords k "
|
||||||
"JOIN moz_bookmarks b ON b.keyword_id = k.id "
|
"JOIN moz_bookmarks b ON b.keyword_id = k.id "
|
||||||
"JOIN moz_places h ON b.fk = h.id "
|
"JOIN moz_places h ON b.fk = h.id "
|
||||||
"WHERE k.keyword = ?1 "
|
"WHERE k.keyword = :keyword "
|
||||||
"LIMIT 1"));
|
"LIMIT 1"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBAdjustPosition, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBAdjustPosition, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET position = position + ?1 "
|
"UPDATE moz_bookmarks SET position = position + :delta "
|
||||||
"WHERE parent = ?2 AND position >= ?3 AND position <= ?4"));
|
"WHERE parent = :parent "
|
||||||
|
"AND position >= :from_index AND position <= :to_index"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBRemoveItem, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBRemoveItem, NS_LITERAL_CSTRING(
|
||||||
"DELETE FROM moz_bookmarks WHERE id = ?1"));
|
"DELETE FROM moz_bookmarks WHERE id = :item_id"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBGetLastChildId, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBGetLastChildId, NS_LITERAL_CSTRING(
|
||||||
"SELECT id FROM moz_bookmarks WHERE parent = ?1 "
|
"SELECT id FROM moz_bookmarks WHERE parent = :parent "
|
||||||
"ORDER BY position DESC LIMIT 1"));
|
"ORDER BY position DESC LIMIT 1"));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBMoveItem, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBMoveItem, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET parent = ?1, position = ?2 WHERE id = ?3 "));
|
"UPDATE moz_bookmarks SET parent = :parent, position = :item_index "
|
||||||
|
"WHERE id = :item_id "));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBSetItemTitle, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBSetItemTitle, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET title = ?1, lastModified = ?2 WHERE id = ?3 "));
|
"UPDATE moz_bookmarks SET title = :item_title, lastModified = :date "
|
||||||
|
"WHERE id = :item_id "));
|
||||||
|
|
||||||
RETURN_IF_STMT(mDBChangeBookmarkURI, NS_LITERAL_CSTRING(
|
RETURN_IF_STMT(mDBChangeBookmarkURI, NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET fk = ?1, lastModified = ?2 WHERE id = ?3 "));
|
"UPDATE moz_bookmarks SET fk = :page_id, lastModified = :date "
|
||||||
|
"WHERE id = :item_id "));
|
||||||
|
|
||||||
// The next query finds the bookmarked ancestors in a redirects chain.
|
// The next query finds the bookmarked ancestors in a redirects chain.
|
||||||
// It won't go further than 3 levels of redirects (a->b->c->your_place_id).
|
// It won't go further than 3 levels of redirects (a->b->c->your_place_id).
|
||||||
|
@ -542,7 +540,7 @@ nsNavBookmarks::InitRoots()
|
||||||
|
|
||||||
nsCOMPtr<mozIStorageStatement> getRootStatement;
|
nsCOMPtr<mozIStorageStatement> getRootStatement;
|
||||||
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"SELECT folder_id FROM moz_bookmarks_roots WHERE root_name = ?1"),
|
"SELECT folder_id FROM moz_bookmarks_roots WHERE root_name = :root_name"),
|
||||||
getter_AddRefs(getRootStatement));
|
getter_AddRefs(getRootStatement));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -573,12 +571,15 @@ nsNavBookmarks::InitRoots()
|
||||||
if (folders.Length() > 0) {
|
if (folders.Length() > 0) {
|
||||||
nsCOMPtr<mozIStorageStatement> moveItems;
|
nsCOMPtr<mozIStorageStatement> moveItems;
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET parent = ?1 WHERE parent=?2"),
|
"UPDATE moz_bookmarks SET parent = :new_parent "
|
||||||
getter_AddRefs(moveItems));
|
"WHERE parent = :old_parent"
|
||||||
|
), getter_AddRefs(moveItems));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = moveItems->BindInt64Parameter(0, mToolbarFolder);
|
rv = moveItems->BindInt64ByName(NS_LITERAL_CSTRING("new_parent"),
|
||||||
|
mToolbarFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = moveItems->BindInt64Parameter(1, folders[0]);
|
rv = moveItems->BindInt64ByName(NS_LITERAL_CSTRING("old_parent"),
|
||||||
|
folders[0]);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = moveItems->Execute();
|
rv = moveItems->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -684,7 +685,7 @@ nsNavBookmarks::CreateRoot(mozIStorageStatement* aGetRootStatement,
|
||||||
NS_ENSURE_STATE(aGetRootStatement);
|
NS_ENSURE_STATE(aGetRootStatement);
|
||||||
mozStorageStatementScoper scoper(aGetRootStatement);
|
mozStorageStatementScoper scoper(aGetRootStatement);
|
||||||
PRBool hasResult = PR_FALSE;
|
PRBool hasResult = PR_FALSE;
|
||||||
nsresult rv = aGetRootStatement->BindUTF8StringParameter(0, name);
|
nsresult rv = aGetRootStatement->BindUTF8StringByName(NS_LITERAL_CSTRING("root_name"), name);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = aGetRootStatement->ExecuteStep(&hasResult);
|
rv = aGetRootStatement->ExecuteStep(&hasResult);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -706,12 +707,13 @@ nsNavBookmarks::CreateRoot(mozIStorageStatement* aGetRootStatement,
|
||||||
|
|
||||||
// save root ID
|
// save root ID
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES (?1, ?2)"),
|
"INSERT INTO moz_bookmarks_roots (root_name, folder_id) "
|
||||||
getter_AddRefs(insertStatement));
|
"VALUES (:root_name, :item_id)"
|
||||||
|
), getter_AddRefs(insertStatement));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = insertStatement->BindUTF8StringParameter(0, name);
|
rv = insertStatement->BindUTF8StringByName(NS_LITERAL_CSTRING("root_name"), name);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = insertStatement->BindInt64Parameter(1, *aID);
|
rv = insertStatement->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), *aID);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = insertStatement->Execute();
|
rv = insertStatement->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -724,11 +726,12 @@ PRBool
|
||||||
nsNavBookmarks::IsRealBookmark(PRInt64 aPlaceId)
|
nsNavBookmarks::IsRealBookmark(PRInt64 aPlaceId)
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsRealBookmark);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsRealBookmark);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aPlaceId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), aPlaceId);
|
||||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
||||||
rv = stmt->BindInt32Parameter(1, TYPE_BOOKMARK);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_type"), TYPE_BOOKMARK);
|
||||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
||||||
rv = BindStatementURLCString(stmt, 2, NS_LITERAL_CSTRING(LMANNO_FEEDURI));
|
rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("anno_name"),
|
||||||
|
NS_LITERAL_CSTRING(LMANNO_FEEDURI));
|
||||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Binding failed");
|
||||||
|
|
||||||
// If we get any rows, then there exists at least one bookmark corresponding
|
// If we get any rows, then there exists at least one bookmark corresponding
|
||||||
|
@ -752,7 +755,7 @@ nsNavBookmarks::IsBookmarkedInDatabase(PRInt64 aPlaceId,
|
||||||
PRBool* aIsBookmarked)
|
PRBool* aIsBookmarked)
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsBookmarkedInDatabase);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsBookmarkedInDatabase);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aPlaceId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), aPlaceId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->ExecuteStep(aIsBookmarked);
|
rv = stmt->ExecuteStep(aIsBookmarked);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -770,13 +773,13 @@ nsNavBookmarks::AdjustIndices(PRInt64 aFolderId,
|
||||||
aStartIndex <= aEndIndex, "Bad indices");
|
aStartIndex <= aEndIndex, "Bad indices");
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBAdjustPosition);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBAdjustPosition);
|
||||||
nsresult rv = stmt->BindInt32Parameter(0, aDelta);
|
nsresult rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("delta"), aDelta);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt64Parameter(1, aFolderId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(2, aStartIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("from_index"), aStartIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(3, aEndIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("to_index"), aEndIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
|
@ -843,44 +846,50 @@ nsNavBookmarks::InsertBookmarkInDB(PRInt64 aItemId,
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBInsertBookmark);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBInsertBookmark);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (aItemId && aItemId != -1)
|
if (aItemId && aItemId != -1)
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_Id, aItemId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
else
|
else
|
||||||
rv = stmt->BindNullParameter(kInsertBookmarkIndex_Id);
|
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("item_id"));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aPlaceId && aPlaceId != -1)
|
if (aPlaceId && aPlaceId != -1)
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_PlaceId, aPlaceId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), aPlaceId);
|
||||||
else
|
else
|
||||||
rv = stmt->BindNullParameter(kInsertBookmarkIndex_PlaceId);
|
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("page_id"));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = stmt->BindInt32Parameter(kInsertBookmarkIndex_Type, aItemType);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_type"), aItemType);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_Parent, aParentId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aParentId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(kInsertBookmarkIndex_Position, aIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_index"), aIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Support NULL titles.
|
// Support NULL titles.
|
||||||
if (aTitle.IsVoid())
|
if (aTitle.IsVoid())
|
||||||
rv = stmt->BindNullParameter(kInsertBookmarkIndex_Title);
|
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("item_title"));
|
||||||
else
|
else
|
||||||
rv = stmt->BindUTF8StringParameter(kInsertBookmarkIndex_Title, aTitle);
|
rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("item_title"), aTitle);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aServiceContractId.IsEmpty())
|
if (aServiceContractId.IsEmpty()) {
|
||||||
rv = stmt->BindNullParameter(kInsertBookmarkIndex_ServiceContractId);
|
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("folder_type"));
|
||||||
else
|
}
|
||||||
rv = stmt->BindStringParameter(kInsertBookmarkIndex_ServiceContractId, aServiceContractId);
|
else {
|
||||||
|
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("folder_type"),
|
||||||
|
aServiceContractId);
|
||||||
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_DateAdded, aDateAdded);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("date_added"), aDateAdded);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aLastModified)
|
if (aLastModified) {
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_LastModified, aLastModified);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("last_modified"),
|
||||||
else
|
aLastModified);
|
||||||
rv = stmt->BindInt64Parameter(kInsertBookmarkIndex_LastModified, aDateAdded);
|
}
|
||||||
|
else {
|
||||||
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("last_modified"), aDateAdded);
|
||||||
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
|
@ -1038,7 +1047,7 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
||||||
|
|
||||||
{ // scoping to ensure the statement gets reset
|
{ // scoping to ensure the statement gets reset
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, aItemId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1081,7 +1090,7 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
||||||
|
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBRemoveItem);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBRemoveItem);
|
||||||
rv = stmt->BindInt64Parameter(0, aItemId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1317,7 +1326,7 @@ nsNavBookmarks::GetLastChildId(PRInt64 aFolderId, PRInt64* aItemId)
|
||||||
*aItemId = -1;
|
*aItemId = -1;
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetLastChildId);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetLastChildId);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aFolderId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRBool found;
|
PRBool found;
|
||||||
rv = stmt->ExecuteStep(&found);
|
rv = stmt->ExecuteStep(&found);
|
||||||
|
@ -1350,9 +1359,9 @@ nsNavBookmarks::GetIdForItemAt(PRInt64 aFolder,
|
||||||
else {
|
else {
|
||||||
// Get the item in aFolder with position aIndex.
|
// Get the item in aFolder with position aIndex.
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildAt);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildAt);
|
||||||
rv = stmt->BindInt64Parameter(0, aFolder);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(1, aIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_index"), aIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool found;
|
PRBool found;
|
||||||
|
@ -1373,7 +1382,7 @@ nsNavBookmarks::GetParentAndIndexOfFolder(PRInt64 aFolderId,
|
||||||
PRInt32* _aIndex)
|
PRInt32* _aIndex)
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aFolderId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1407,7 +1416,7 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
|
||||||
nsCAutoString folderType;
|
nsCAutoString folderType;
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, aFolderId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1455,7 +1464,7 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
|
||||||
{
|
{
|
||||||
// Remove the folder from its parent.
|
// Remove the folder from its parent.
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBRemoveItem);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBRemoveItem);
|
||||||
rv = stmt->BindInt64Parameter(0, aFolderId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1514,7 +1523,7 @@ nsNavBookmarks::GetDescendantChildren(PRInt64 aFolderId,
|
||||||
{
|
{
|
||||||
// Collect children informations.
|
// Collect children informations.
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildren);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildren);
|
||||||
rv = stmt->BindInt64Parameter(0, aFolderId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasMore;
|
PRBool hasMore;
|
||||||
|
@ -1577,7 +1586,7 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
||||||
PRInt64 grandParentId;
|
PRInt64 grandParentId;
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, aFolderId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Sanity check: ensure that item exists.
|
// Sanity check: ensure that item exists.
|
||||||
|
@ -1638,12 +1647,12 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
||||||
nsCOMPtr<mozIStorageStatement> deleteStatement;
|
nsCOMPtr<mozIStorageStatement> deleteStatement;
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"DELETE FROM moz_bookmarks "
|
"DELETE FROM moz_bookmarks "
|
||||||
"WHERE parent IN (?1") +
|
"WHERE parent IN (:parent") +
|
||||||
foldersToRemove +
|
foldersToRemove +
|
||||||
NS_LITERAL_CSTRING(")"),
|
NS_LITERAL_CSTRING(")"),
|
||||||
getter_AddRefs(deleteStatement));
|
getter_AddRefs(deleteStatement));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = deleteStatement->BindInt64Parameter(0, aFolderId);
|
rv = deleteStatement->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = deleteStatement->Execute();
|
rv = deleteStatement->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1742,7 +1751,7 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId, PRInt64 aNewParent, PRInt32 aIndex)
|
||||||
nsCAutoString folderType;
|
nsCAutoString folderType;
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, aItemId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1779,7 +1788,8 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId, PRInt64 aNewParent, PRInt32 aIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(getInfoStmt, mDBGetItemProperties);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, ancestorId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"),
|
||||||
|
ancestorId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1855,11 +1865,11 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId, PRInt64 aNewParent, PRInt32 aIndex)
|
||||||
{
|
{
|
||||||
// Update parent and position.
|
// Update parent and position.
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBMoveItem);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBMoveItem);
|
||||||
rv = stmt->BindInt64Parameter(0, aNewParent);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aNewParent);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(1, newIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_index"), newIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt64Parameter(2, aItemId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1902,9 +1912,9 @@ nsNavBookmarks::SetItemDateInternal(mozIStorageStatement* aStatement,
|
||||||
NS_ENSURE_STATE(aStatement);
|
NS_ENSURE_STATE(aStatement);
|
||||||
mozStorageStatementScoper scoper(aStatement);
|
mozStorageStatementScoper scoper(aStatement);
|
||||||
|
|
||||||
nsresult rv = aStatement->BindInt64Parameter(0, aValue);
|
nsresult rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("date"), aValue);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = aStatement->BindInt64Parameter(1, aItemId);
|
rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = aStatement->Execute();
|
rv = aStatement->Execute();
|
||||||
|
@ -1947,7 +1957,7 @@ nsNavBookmarks::GetItemDateAdded(PRInt64 aItemId, PRTime* _dateAdded)
|
||||||
NS_ENSURE_ARG_POINTER(_dateAdded);
|
NS_ENSURE_ARG_POINTER(_dateAdded);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -1991,7 +2001,7 @@ nsNavBookmarks::GetItemLastModified(PRInt64 aItemId, PRTime* aLastModified)
|
||||||
NS_ENSURE_ARG_POINTER(aLastModified);
|
NS_ENSURE_ARG_POINTER(aLastModified);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2081,7 +2091,7 @@ nsNavBookmarks::GetItemIdForGUID(const nsAString& aGUID, PRInt64* aItemId)
|
||||||
NS_ENSURE_ARG_POINTER(aItemId);
|
NS_ENSURE_ARG_POINTER(aItemId);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemIdForGUID);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemIdForGUID);
|
||||||
nsresult rv = stmt->BindStringParameter(0, aGUID);
|
nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("guid"), aGUID);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasMore = PR_FALSE;
|
PRBool hasMore = PR_FALSE;
|
||||||
|
@ -2109,14 +2119,14 @@ nsNavBookmarks::SetItemTitle(PRInt64 aItemId, const nsACString& aTitle)
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(statement, mDBSetItemTitle);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(statement, mDBSetItemTitle);
|
||||||
// Support setting a null title, we support this in insertBookmark.
|
// Support setting a null title, we support this in insertBookmark.
|
||||||
if (aTitle.IsVoid())
|
if (aTitle.IsVoid())
|
||||||
rv = statement->BindNullParameter(0);
|
rv = statement->BindNullByName(NS_LITERAL_CSTRING("item_title"));
|
||||||
else
|
else
|
||||||
rv = statement->BindUTF8StringParameter(0, aTitle);
|
rv = statement->BindUTF8StringByName(NS_LITERAL_CSTRING("item_title"), aTitle);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRTime lastModified = PR_Now();
|
PRTime lastModified = PR_Now();
|
||||||
rv = statement->BindInt64Parameter(1, lastModified);
|
rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("date"), lastModified);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = statement->BindInt64Parameter(2, aItemId);
|
rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = statement->Execute();
|
rv = statement->Execute();
|
||||||
|
@ -2136,7 +2146,7 @@ nsNavBookmarks::GetItemTitle(PRInt64 aItemId, nsACString& aTitle)
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2159,7 +2169,7 @@ nsNavBookmarks::GetBookmarkURI(PRInt64 aItemId, nsIURI** aURI)
|
||||||
NS_ENSURE_ARG_POINTER(aURI);
|
NS_ENSURE_ARG_POINTER(aURI);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2193,7 +2203,7 @@ nsNavBookmarks::GetItemType(PRInt64 aItemId, PRUint16* _type)
|
||||||
NS_ENSURE_ARG_POINTER(_type);
|
NS_ENSURE_ARG_POINTER(_type);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2217,7 +2227,7 @@ nsresult
|
||||||
nsNavBookmarks::GetFolderType(PRInt64 aFolder, nsACString& aType)
|
nsNavBookmarks::GetFolderType(PRInt64 aFolder, nsACString& aType)
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aFolder);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2238,7 +2248,7 @@ nsNavBookmarks::ResultNodeForContainer(PRInt64 aID,
|
||||||
nsNavHistoryResultNode** aNode)
|
nsNavHistoryResultNode** aNode)
|
||||||
{
|
{
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aID);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aID);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2293,7 +2303,7 @@ nsNavBookmarks::QueryFolderChildren(
|
||||||
NS_ENSURE_ARG_POINTER(aChildren);
|
NS_ENSURE_ARG_POINTER(aChildren);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildren);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetChildren);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aFolderId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<mozIStorageValueArray> row = do_QueryInterface(stmt, &rv);
|
nsCOMPtr<mozIStorageValueArray> row = do_QueryInterface(stmt, &rv);
|
||||||
|
@ -2405,7 +2415,8 @@ nsNavBookmarks::QueryFolderChildrenAsync(
|
||||||
|
|
||||||
mozStorageStatementScoper scope(mDBGetChildren);
|
mozStorageStatementScoper scope(mDBGetChildren);
|
||||||
|
|
||||||
nsresult rv = mDBGetChildren->BindInt64Parameter(0, aFolderId);
|
nsresult rv = mDBGetChildren->BindInt64ByName(NS_LITERAL_CSTRING("parent"),
|
||||||
|
aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<mozIStoragePendingStatement> pendingStmt;
|
nsCOMPtr<mozIStoragePendingStatement> pendingStmt;
|
||||||
|
@ -2422,7 +2433,7 @@ nsNavBookmarks::FolderCount(PRInt64 aFolderId, PRInt32* _folderCount)
|
||||||
{
|
{
|
||||||
*_folderCount = 0;
|
*_folderCount = 0;
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBFolderCount);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBFolderCount);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aFolderId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("parent"), aFolderId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2450,7 +2461,7 @@ nsNavBookmarks::IsBookmarked(nsIURI* aURI, PRBool* aBookmarked)
|
||||||
NS_ENSURE_ARG_POINTER(aBookmarked);
|
NS_ENSURE_ARG_POINTER(aBookmarked);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsURIBookmarkedInDatabase);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBIsURIBookmarkedInDatabase);
|
||||||
nsresult rv = BindStatementURI(stmt, 0, aURI);
|
nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->ExecuteStep(aBookmarked);
|
rv = stmt->ExecuteStep(aBookmarked);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -2526,12 +2537,12 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI* aNewURI)
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(statement, mDBChangeBookmarkURI);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(statement, mDBChangeBookmarkURI);
|
||||||
rv = statement->BindInt64Parameter(0, placeId);
|
rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), placeId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRTime lastModified = PR_Now();
|
PRTime lastModified = PR_Now();
|
||||||
rv = statement->BindInt64Parameter(1, lastModified);
|
rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("date"), lastModified);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = statement->BindInt64Parameter(2, aBookmarkId);
|
rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aBookmarkId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = statement->Execute();
|
rv = statement->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -2576,7 +2587,7 @@ nsNavBookmarks::GetFolderIdForItem(PRInt64 aItemId, PRInt64* aFolderId)
|
||||||
NS_ENSURE_ARG_POINTER(aFolderId);
|
NS_ENSURE_ARG_POINTER(aFolderId);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2602,9 +2613,9 @@ nsNavBookmarks::GetBookmarkIdsForURITArray(nsIURI* aURI,
|
||||||
NS_ENSURE_ARG(aURI);
|
NS_ENSURE_ARG(aURI);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBFindURIBookmarks);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBFindURIBookmarks);
|
||||||
nsresult rv = BindStatementURI(stmt, 0, aURI);
|
nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(1, TYPE_BOOKMARK);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_type"), TYPE_BOOKMARK);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool more;
|
PRBool more;
|
||||||
|
@ -2660,7 +2671,7 @@ nsNavBookmarks::GetItemIndex(PRInt64 aItemId, PRInt32* _index)
|
||||||
*_index = -1;
|
*_index = -1;
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
rv = stmt->ExecuteStep(&hasResult);
|
rv = stmt->ExecuteStep(&hasResult);
|
||||||
|
@ -2690,7 +2701,7 @@ nsNavBookmarks::SetItemIndex(PRInt64 aItemId, PRInt32 aNewIndex)
|
||||||
mozIStorageStatement* getInfoStmt(mDBGetItemProperties);
|
mozIStorageStatement* getInfoStmt(mDBGetItemProperties);
|
||||||
NS_ENSURE_STATE(getInfoStmt);
|
NS_ENSURE_STATE(getInfoStmt);
|
||||||
mozStorageStatementScoper scoper(getInfoStmt);
|
mozStorageStatementScoper scoper(getInfoStmt);
|
||||||
rv = getInfoStmt->BindInt64Parameter(0, aItemId);
|
rv = getInfoStmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
@ -2714,9 +2725,9 @@ nsNavBookmarks::SetItemIndex(PRInt64 aItemId, PRInt32 aNewIndex)
|
||||||
NS_ENSURE_TRUE(aNewIndex < folderCount, NS_ERROR_INVALID_ARG);
|
NS_ENSURE_TRUE(aNewIndex < folderCount, NS_ERROR_INVALID_ARG);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBSetItemIndex);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBSetItemIndex);
|
||||||
rv = stmt->BindInt64Parameter(0, aItemId);
|
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = stmt->BindInt32Parameter(1, aNewIndex);
|
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("item_index"), aNewIndex);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
|
@ -2748,10 +2759,10 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId,
|
||||||
// Attempt to find a pre-existing keyword record.
|
// Attempt to find a pre-existing keyword record.
|
||||||
nsCOMPtr<mozIStorageStatement> getKeywordStmnt;
|
nsCOMPtr<mozIStorageStatement> getKeywordStmnt;
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"SELECT id from moz_keywords WHERE keyword = ?1"),
|
"SELECT id from moz_keywords WHERE keyword = :keyword"),
|
||||||
getter_AddRefs(getKeywordStmnt));
|
getter_AddRefs(getKeywordStmnt));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = getKeywordStmnt->BindStringParameter(0, kwd);
|
rv = getKeywordStmnt->BindStringByName(NS_LITERAL_CSTRING("keyword"), kwd);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
rv = getKeywordStmnt->ExecuteStep(&hasResult);
|
rv = getKeywordStmnt->ExecuteStep(&hasResult);
|
||||||
|
@ -2765,10 +2776,10 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId,
|
||||||
// Create a new keyword record.
|
// Create a new keyword record.
|
||||||
nsCOMPtr<mozIStorageStatement> addKeywordStmnt;
|
nsCOMPtr<mozIStorageStatement> addKeywordStmnt;
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"INSERT INTO moz_keywords (keyword) VALUES (?1)"),
|
"INSERT INTO moz_keywords (keyword) VALUES (:keyword)"),
|
||||||
getter_AddRefs(addKeywordStmnt));
|
getter_AddRefs(addKeywordStmnt));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = addKeywordStmnt->BindStringParameter(0, kwd);
|
rv = addKeywordStmnt->BindStringByName(NS_LITERAL_CSTRING("keyword"), kwd);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = addKeywordStmnt->Execute();
|
rv = addKeywordStmnt->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -2793,19 +2804,22 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId,
|
||||||
// Update bookmark record w/ the keyword's id or null.
|
// Update bookmark record w/ the keyword's id or null.
|
||||||
nsCOMPtr<mozIStorageStatement> updateKeywordStmnt;
|
nsCOMPtr<mozIStorageStatement> updateKeywordStmnt;
|
||||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
"UPDATE moz_bookmarks SET keyword_id = ?1, lastModified = ?2 "
|
"UPDATE moz_bookmarks SET keyword_id = :keyword_id, lastModified = :date "
|
||||||
"WHERE id = ?3"),
|
"WHERE id = :item_id"),
|
||||||
getter_AddRefs(updateKeywordStmnt));
|
getter_AddRefs(updateKeywordStmnt));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (keywordId > 0)
|
if (keywordId > 0) {
|
||||||
rv = updateKeywordStmnt->BindInt64Parameter(0, keywordId);
|
rv = updateKeywordStmnt->BindInt64ByName(NS_LITERAL_CSTRING("keyword_id"),
|
||||||
else
|
keywordId);
|
||||||
rv = updateKeywordStmnt->BindNullParameter(0);
|
}
|
||||||
|
else {
|
||||||
|
rv = updateKeywordStmnt->BindNullByName(NS_LITERAL_CSTRING("keyword_id"));
|
||||||
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRTime lastModified = PR_Now();
|
PRTime lastModified = PR_Now();
|
||||||
rv = updateKeywordStmnt->BindInt64Parameter(1, lastModified);
|
rv = updateKeywordStmnt->BindInt64ByName(NS_LITERAL_CSTRING("date"), lastModified);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = updateKeywordStmnt->BindInt64Parameter(2, aBookmarkId);
|
rv = updateKeywordStmnt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aBookmarkId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = updateKeywordStmnt->Execute();
|
rv = updateKeywordStmnt->Execute();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -2831,7 +2845,7 @@ nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword)
|
||||||
aKeyword.Truncate(0);
|
aKeyword.Truncate(0);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetKeywordForURI);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetKeywordForURI);
|
||||||
nsresult rv = BindStatementURI(stmt, 0, aURI);
|
nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasMore = PR_FALSE;
|
PRBool hasMore = PR_FALSE;
|
||||||
|
@ -2855,7 +2869,8 @@ nsNavBookmarks::GetKeywordForBookmark(PRInt64 aBookmarkId, nsAString& aKeyword)
|
||||||
aKeyword.Truncate(0);
|
aKeyword.Truncate(0);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetKeywordForBookmark);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetKeywordForBookmark);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aBookmarkId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"),
|
||||||
|
aBookmarkId);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasMore = PR_FALSE;
|
PRBool hasMore = PR_FALSE;
|
||||||
|
@ -2884,7 +2899,7 @@ nsNavBookmarks::GetURIForKeyword(const nsAString& aKeyword, nsIURI** aURI)
|
||||||
ToLowerCase(kwd);
|
ToLowerCase(kwd);
|
||||||
|
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetURIForKeyword);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetURIForKeyword);
|
||||||
nsresult rv = stmt->BindStringParameter(0, kwd);
|
nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("keyword"), kwd);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool hasMore = PR_FALSE;
|
PRBool hasMore = PR_FALSE;
|
||||||
|
@ -3185,7 +3200,7 @@ nsNavBookmarks::OnItemAnnotationRemoved(PRInt64 aItemId, const nsACString& aName
|
||||||
PRBool
|
PRBool
|
||||||
nsNavBookmarks::ItemExists(PRInt64 aItemId) {
|
nsNavBookmarks::ItemExists(PRInt64 aItemId) {
|
||||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
|
||||||
nsresult rv = stmt->BindInt64Parameter(0, aItemId);
|
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), aItemId);
|
||||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||||
|
|
||||||
PRBool hasResult;
|
PRBool hasResult;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче