mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
backout merge
This commit is contained in:
commit
9bf0fdc3ad
@ -878,10 +878,6 @@ nsNavHistory::InitDB(PRInt16 *aMadeChanges)
|
|||||||
|
|
||||||
// DO NOT PUT ANY SCHEMA-MODIFYING THINGS HERE
|
// DO NOT PUT ANY SCHEMA-MODIFYING THINGS HERE
|
||||||
|
|
||||||
rv = InitTempTables();
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = InitViews();
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = InitFunctions();
|
rv = InitFunctions();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = InitStatements();
|
rv = InitStatements();
|
||||||
@ -960,88 +956,6 @@ NS_IMETHODIMP mozStorageFunctionGetUnreversedHost::OnFunctionCall(
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsNavHistory::InitTempTables()
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
// moz_places_temp
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_PLACES_TEMP);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE UNIQUE INDEX moz_places_temp_url_uniqueindex ON moz_places_temp (url)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_places_temp_faviconindex ON moz_places_temp (favicon_id)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_places_temp_hostindex ON moz_places_temp (rev_host)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_places_temp_visitcount ON moz_places_temp (visit_count)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_places_temp_frecencyindex ON moz_places_temp (frecency)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
|
|
||||||
// moz_historyvisits_temp
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_HISTORYVISITS_TEMP);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_historyvisits_temp_placedateindex "
|
|
||||||
"ON moz_historyvisits_temp (place_id, visit_date)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_historyvisits_temp_fromindex "
|
|
||||||
"ON moz_historyvisits_temp (from_visit)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
|
||||||
"CREATE INDEX moz_historyvisits_temp_dateindex "
|
|
||||||
"ON moz_historyvisits_temp (visit_date)"));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsNavHistory::InitViews()
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
// moz_places_view
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_PLACES_VIEW);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_PLACES_VIEW_INSERT_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_PLACES_VIEW_DELETE_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_PLACES_VIEW_UPDATE_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
// moz_historyvisits_view
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_MOZ_HISTORYVISITS_VIEW);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_HISTORYVISITS_VIEW_INSERT_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_HISTORYVISITS_VIEW_DELETE_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = mDBConn->ExecuteSimpleSQL(CREATE_HISTORYVISITS_VIEW_UPDATE_TRIGGER);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsNavHistory::InitFunctions()
|
nsNavHistory::InitFunctions()
|
||||||
{
|
{
|
||||||
|
@ -463,8 +463,6 @@ protected:
|
|||||||
* The database was migrated to a new version.
|
* The database was migrated to a new version.
|
||||||
*/
|
*/
|
||||||
nsresult InitDB(PRInt16 *aMadeChanges);
|
nsresult InitDB(PRInt16 *aMadeChanges);
|
||||||
nsresult InitTempTables();
|
|
||||||
nsresult InitViews();
|
|
||||||
nsresult InitFunctions();
|
nsresult InitFunctions();
|
||||||
nsresult InitStatements();
|
nsresult InitStatements();
|
||||||
nsresult ForceMigrateBookmarksDB(mozIStorageConnection *aDBConn);
|
nsresult ForceMigrateBookmarksDB(mozIStorageConnection *aDBConn);
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
#ifndef __nsPlacesTables_h__
|
#ifndef __nsPlacesTables_h__
|
||||||
#define __nsPlacesTables_h__
|
#define __nsPlacesTables_h__
|
||||||
|
|
||||||
#define CREATE_MOZ_PLACES_BASE(__name, __temporary) NS_LITERAL_CSTRING( \
|
#define CREATE_MOZ_PLACES NS_LITERAL_CSTRING( \
|
||||||
"CREATE " __temporary " TABLE " __name " ( " \
|
"CREATE TABLE moz_places ( " \
|
||||||
" id INTEGER PRIMARY KEY" \
|
" id INTEGER PRIMARY KEY" \
|
||||||
", url LONGVARCHAR" \
|
", url LONGVARCHAR" \
|
||||||
", title LONGVARCHAR" \
|
", title LONGVARCHAR" \
|
||||||
@ -52,18 +52,9 @@
|
|||||||
", frecency INTEGER DEFAULT -1 NOT NULL" \
|
", frecency INTEGER DEFAULT -1 NOT NULL" \
|
||||||
")" \
|
")" \
|
||||||
)
|
)
|
||||||
#define CREATE_MOZ_PLACES CREATE_MOZ_PLACES_BASE("moz_places", "")
|
|
||||||
#define CREATE_MOZ_PLACES_TEMP CREATE_MOZ_PLACES_BASE("moz_places_temp", "TEMP")
|
|
||||||
#define CREATE_MOZ_PLACES_VIEW NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY VIEW moz_places_view AS " \
|
|
||||||
"SELECT * FROM moz_places_temp " \
|
|
||||||
"UNION ALL " \
|
|
||||||
"SELECT * FROM moz_places " \
|
|
||||||
"WHERE id NOT IN (SELECT id FROM moz_places_temp) " \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define CREATE_MOZ_HISTORYVISITS_BASE(__name, __temporary) NS_LITERAL_CSTRING( \
|
#define CREATE_MOZ_HISTORYVISITS NS_LITERAL_CSTRING( \
|
||||||
"CREATE " __temporary " TABLE " __name " (" \
|
"CREATE TABLE moz_historyvisits (" \
|
||||||
" id INTEGER PRIMARY KEY" \
|
" id INTEGER PRIMARY KEY" \
|
||||||
", from_visit INTEGER" \
|
", from_visit INTEGER" \
|
||||||
", place_id INTEGER" \
|
", place_id INTEGER" \
|
||||||
@ -72,17 +63,6 @@
|
|||||||
", session INTEGER" \
|
", session INTEGER" \
|
||||||
")" \
|
")" \
|
||||||
)
|
)
|
||||||
#define CREATE_MOZ_HISTORYVISITS \
|
|
||||||
CREATE_MOZ_HISTORYVISITS_BASE("moz_historyvisits", "")
|
|
||||||
#define CREATE_MOZ_HISTORYVISITS_TEMP \
|
|
||||||
CREATE_MOZ_HISTORYVISITS_BASE("moz_historyvisits_temp", "TEMP")
|
|
||||||
#define CREATE_MOZ_HISTORYVISITS_VIEW NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY VIEW moz_historyvisits_view AS " \
|
|
||||||
"SELECT * FROM moz_historyvisits_temp " \
|
|
||||||
"UNION ALL " \
|
|
||||||
"SELECT * FROM moz_historyvisits " \
|
|
||||||
"WHERE id NOT IN (SELECT id FROM moz_historyvisits_temp) " \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define CREATE_MOZ_INPUTHISTORY NS_LITERAL_CSTRING( \
|
#define CREATE_MOZ_INPUTHISTORY NS_LITERAL_CSTRING( \
|
||||||
"CREATE TABLE moz_inputhistory (" \
|
"CREATE TABLE moz_inputhistory (" \
|
||||||
|
@ -93,145 +93,4 @@
|
|||||||
"END" \
|
"END" \
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for an insertion into moz_places_view. It enters the new
|
|
||||||
* data into the temporary table, ensuring that the new id is one greater than
|
|
||||||
* the largest id value found.
|
|
||||||
*/
|
|
||||||
#define CREATE_PLACES_VIEW_INSERT_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_places_view_insert_trigger " \
|
|
||||||
"INSTEAD OF INSERT " \
|
|
||||||
"ON moz_places_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"INSERT INTO moz_places_temp ( " \
|
|
||||||
"id, url, title, rev_host, visit_count, hidden, typed, favicon_id, " \
|
|
||||||
"frecency " \
|
|
||||||
") " \
|
|
||||||
"VALUES (MAX((SELECT IFNULL(MAX(id), 0) FROM moz_places_temp), " \
|
|
||||||
"(SELECT IFNULL(MAX(id), 0) FROM moz_places)) + 1, " \
|
|
||||||
"NEW.url, NEW.title, NEW.rev_host, " \
|
|
||||||
"IFNULL(NEW.visit_count, 0), " /* enforce having a value */ \
|
|
||||||
"NEW.hidden, NEW.typed, NEW.favicon_id, NEW.frecency);" \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for the deletion of a record in moz_places_view. It
|
|
||||||
* removes any entry in the temporary table, and any entry in the permanent
|
|
||||||
* table as well.
|
|
||||||
*/
|
|
||||||
#define CREATE_PLACES_VIEW_DELETE_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_places_view_delete_trigger " \
|
|
||||||
"INSTEAD OF DELETE " \
|
|
||||||
"ON moz_places_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"DELETE FROM moz_places_temp " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"DELETE FROM moz_places " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for updates to a record in moz_places_view. It first
|
|
||||||
* copies the row from the permanent table over to the temp table if it does not
|
|
||||||
* exist in the temporary table. Then, it will update the temporary table with
|
|
||||||
* the new data.
|
|
||||||
*/
|
|
||||||
#define CREATE_PLACES_VIEW_UPDATE_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_places_view_update_trigger " \
|
|
||||||
"INSTEAD OF UPDATE " \
|
|
||||||
"ON moz_places_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"INSERT INTO moz_places_temp " \
|
|
||||||
"SELECT * " \
|
|
||||||
"FROM moz_places " \
|
|
||||||
"WHERE id = OLD.id " \
|
|
||||||
"AND id NOT IN (SELECT id FROM moz_places_temp); " \
|
|
||||||
"UPDATE moz_places_temp " \
|
|
||||||
"SET url = IFNULL(NEW.url, OLD.url), " \
|
|
||||||
"title = IFNULL(NEW.title, OLD.title), " \
|
|
||||||
"rev_host = IFNULL(NEW.rev_host, OLD.rev_host), " \
|
|
||||||
"visit_count = IFNULL(NEW.visit_count, OLD.visit_count), " \
|
|
||||||
"hidden = IFNULL(NEW.hidden, OLD.hidden), " \
|
|
||||||
"typed = IFNULL(NEW.typed, OLD.typed), " \
|
|
||||||
"favicon_id = IFNULL(NEW.favicon_id, OLD.favicon_id), " \
|
|
||||||
"frecency = IFNULL(NEW.frecency, OLD.frecency) " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for an insertion into moz_historyvisits_view. It enters
|
|
||||||
* the new data into the temporary table, ensuring that the new id is one
|
|
||||||
* greater than the largest id value found. It then updates moz_places_view
|
|
||||||
* with the new visit count.
|
|
||||||
*/
|
|
||||||
#define CREATE_HISTORYVISITS_VIEW_INSERT_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_historyvisits_view_insert_trigger " \
|
|
||||||
"INSTEAD OF INSERT " \
|
|
||||||
"ON moz_historyvisits_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"INSERT INTO moz_historyvisits_temp ( " \
|
|
||||||
"id, from_visit, place_id, visit_date, visit_type, session " \
|
|
||||||
") " \
|
|
||||||
"VALUES (MAX((SELECT IFNULL(MAX(id), 0) FROM moz_historyvisits_temp), " \
|
|
||||||
"(SELECT IFNULL(MAX(id), 0) FROM moz_historyvisits)) + 1, " \
|
|
||||||
"NEW.from_visit, NEW.place_id, NEW.visit_date, NEW.visit_type, " \
|
|
||||||
"NEW.session); " \
|
|
||||||
"UPDATE moz_places_view " \
|
|
||||||
"SET visit_count = visit_count + 1 " \
|
|
||||||
"WHERE id = NEW.place_id " \
|
|
||||||
"AND NEW.visit_type NOT IN (0, 4, 7); " /* invalid, EMBED, DOWNLOAD */ \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for the deletion of a record in moz_historyvisits_view.
|
|
||||||
* It removes any entry in the temporary table, and removes any entry in the
|
|
||||||
* permanent table as well. It then updates moz_places_view with the new visit
|
|
||||||
* count.
|
|
||||||
*/
|
|
||||||
#define CREATE_HISTORYVISITS_VIEW_DELETE_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_historyvisits_view_delete_trigger " \
|
|
||||||
"INSTEAD OF DELETE " \
|
|
||||||
"ON moz_historyvisits_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"DELETE FROM moz_historyvisits_temp " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"DELETE FROM moz_historyvisits " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"UPDATE moz_places_view " \
|
|
||||||
"SET visit_count = visit_count - 1 " \
|
|
||||||
"WHERE moz_places_view.id = OLD.place_id " \
|
|
||||||
"AND OLD.visit_type NOT IN (0, 4, 7); " /* invalid, EMBED, DOWNLOAD */ \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trigger allows for updates to a record in moz_historyvisits_view. It
|
|
||||||
* first copies the row from the permanent table over to the temp table if it
|
|
||||||
* does not exist in the temporary table. Then it will update the temporary
|
|
||||||
* table with the new data.
|
|
||||||
*/
|
|
||||||
#define CREATE_HISTORYVISITS_VIEW_UPDATE_TRIGGER NS_LITERAL_CSTRING( \
|
|
||||||
"CREATE TEMPORARY TRIGGER moz_historyvisits_view_update_trigger " \
|
|
||||||
"INSTEAD OF UPDATE " \
|
|
||||||
"ON moz_historyvisits_view " \
|
|
||||||
"BEGIN " \
|
|
||||||
"INSERT INTO moz_historyvisits_temp " \
|
|
||||||
"SELECT * " \
|
|
||||||
"FROM moz_historyvisits " \
|
|
||||||
"WHERE id = OLD.id " \
|
|
||||||
"AND id NOT IN (SELECT id FROM moz_historyvisits_temp); " \
|
|
||||||
"UPDATE moz_historyvisits_temp " \
|
|
||||||
"SET from_visit = IFNULL(NEW.from_visit, OLD.from_visit), " \
|
|
||||||
"place_id = IFNULL(NEW.place_id, OLD.place_id), " \
|
|
||||||
"visit_date = IFNULL(NEW.visit_date, OLD.visit_date), " \
|
|
||||||
"visit_type = IFNULL(NEW.visit_type, OLD.visit_type), " \
|
|
||||||
"session = IFNULL(NEW.session, OLD.session) " \
|
|
||||||
"WHERE id = OLD.id; " \
|
|
||||||
"END" \
|
|
||||||
)
|
|
||||||
|
|
||||||
#endif // __nsPlacesTriggers_h__
|
#endif // __nsPlacesTriggers_h__
|
||||||
|
Loading…
Reference in New Issue
Block a user