Merge bug 616001 follow-up. a=blocking-beta9

This commit is contained in:
Philipp von Weitershausen 2010-12-15 16:11:29 -08:00
Родитель 0d066bb33d 91b699daac
Коммит 47ca2942ea
3 изменённых файлов: 46 добавлений и 22 удалений

Просмотреть файл

@ -821,6 +821,22 @@ BookmarksStore.prototype = {
query); query);
}, },
__haveGUIDColumn: null,
get _haveGUIDColumn() {
if (this.__haveGUIDColumn !== null) {
return this.__haveGUIDColumn;
}
let stmt;
try {
stmt = this._hsvc.DBConnection.createStatement(
"SELECT guid FROM moz_places");
stmt.finalize();
return this.__haveGUIDColumn = true;
} catch(ex) {
return this.__haveGUIDColumn = false;
}
},
get _frecencyStm() { get _frecencyStm() {
return this._getStmt( return this._getStmt(
"SELECT frecency " + "SELECT frecency " +
@ -867,13 +883,12 @@ BookmarksStore.prototype = {
// Obtains a statement to set the guid iff the guid column exists. // Obtains a statement to set the guid iff the guid column exists.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"UPDATE moz_bookmarks " + "UPDATE moz_bookmarks " +
"SET guid = :guid " + "SET guid = :guid " +
"WHERE id = :item_id"); "WHERE id = :item_id");
} } else {
catch (e) {
stmt = false; stmt = false;
} }
return this.__setGUIDStm = stmt; return this.__setGUIDStm = stmt;
@ -936,13 +951,12 @@ BookmarksStore.prototype = {
// fail, however, if the guid column does not exist. We fallback to just // fail, however, if the guid column does not exist. We fallback to just
// reading the annotation table in this case. // reading the annotation table in this case.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT guid " + "SELECT guid " +
"FROM moz_bookmarks " + "FROM moz_bookmarks " +
"WHERE id = :item_id"); "WHERE id = :item_id");
} } else {
catch (e) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT a.content AS guid " + "SELECT a.content AS guid " +
"FROM moz_items_annos a " + "FROM moz_items_annos a " +
@ -983,13 +997,12 @@ BookmarksStore.prototype = {
// fail, however, if the guid column does not exist. We fallback to just // fail, however, if the guid column does not exist. We fallback to just
// reading the annotation table in this case. // reading the annotation table in this case.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT id AS item_id " + "SELECT id AS item_id " +
"FROM moz_bookmarks " + "FROM moz_bookmarks " +
"WHERE guid = :guid"); "WHERE guid = :guid");
} } else {
catch (e) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT a.item_id AS item_id " + "SELECT a.item_id AS item_id " +
"FROM moz_items_annos a " + "FROM moz_items_annos a " +

Просмотреть файл

@ -114,13 +114,29 @@ HistoryStore.prototype = {
"WHERE name IN ('moz_places_temp', 'moz_historyvisits_temp')"); "WHERE name IN ('moz_places_temp', 'moz_historyvisits_temp')");
}, },
__haveTempTables: null,
get _haveTempTables() { get _haveTempTables() {
if (this.__haveTempTables == null) if (this.__haveTempTables === null)
this.__haveTempTables = !!Utils.queryAsync(this._haveTempTablesStm, this.__haveTempTables = !!Utils.queryAsync(this._haveTempTablesStm,
["name"]).length; ["name"]).length;
return this.__haveTempTables; return this.__haveTempTables;
}, },
__haveGUIDColumn: null,
get _haveGUIDColumn() {
if (this.__haveGUIDColumn !== null) {
return this.__haveGUIDColumn;
}
let stmt;
try {
stmt = this._db.createStatement("SELECT guid FROM moz_places");
stmt.finalize();
return this.__haveGUIDColumn = true;
} catch(ex) {
return this.__haveGUIDColumn = false;
}
},
get _addGUIDAnnotationNameStm() { get _addGUIDAnnotationNameStm() {
// Gecko <2.0 only // Gecko <2.0 only
let stmt = this._getStmt( let stmt = this._getStmt(
@ -162,13 +178,12 @@ HistoryStore.prototype = {
// Obtains a statement to set the guid iff the guid column exists. // Obtains a statement to set the guid iff the guid column exists.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"UPDATE moz_places " + "UPDATE moz_places " +
"SET guid = :guid " + "SET guid = :guid " +
"WHERE url = :page_url"); "WHERE url = :page_url");
} } else {
catch (e) {
stmt = false; stmt = false;
} }
@ -235,13 +250,12 @@ HistoryStore.prototype = {
// if the column doesn't exist, though so fallback to just reading from // if the column doesn't exist, though so fallback to just reading from
// the annotation table. // the annotation table.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT guid " + "SELECT guid " +
"FROM moz_places " + "FROM moz_places " +
"WHERE url = :page_url"); "WHERE url = :page_url");
} } else {
catch (e) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT a.content AS guid " + "SELECT a.content AS guid " +
"FROM moz_annos a " + "FROM moz_annos a " +
@ -304,13 +318,12 @@ HistoryStore.prototype = {
// if the column doesn't exist, though so fallback to just reading from // if the column doesn't exist, though so fallback to just reading from
// the annotation table. // the annotation table.
let stmt; let stmt;
try { if (this._haveGUIDColumn) {
stmt = this._getStmt( stmt = this._getStmt(
"SELECT url, title, frecency " + "SELECT url, title, frecency " +
"FROM moz_places " + "FROM moz_places " +
"WHERE guid = :guid"); "WHERE guid = :guid");
} } else {
catch (e) {
let where = let where =
"WHERE id = (" + "WHERE id = (" +
"SELECT place_id " + "SELECT place_id " +

Просмотреть файл

@ -1958,9 +1958,7 @@ WeaveSvc.prototype = {
*/ */
resetService: function WeaveSvc_resetService() resetService: function WeaveSvc_resetService()
this._catch(this._notify("reset-service", "", function() { this._catch(this._notify("reset-service", "", function() {
// First drop old logs to track client resetting behavior this._log.info("Service reset.");
this.clearLogs();
this._log.info("Logs reinitialized for service reset");
// Pretend we've never synced to the server and drop cached data // Pretend we've never synced to the server and drop cached data
this.syncID = ""; this.syncID = "";