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);
},
__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() {
return this._getStmt(
"SELECT frecency " +
@ -867,13 +883,12 @@ BookmarksStore.prototype = {
// Obtains a statement to set the guid iff the guid column exists.
let stmt;
try {
if (this._haveGUIDColumn) {
stmt = this._getStmt(
"UPDATE moz_bookmarks " +
"SET guid = :guid " +
"WHERE id = :item_id");
}
catch (e) {
} else {
stmt = false;
}
return this.__setGUIDStm = stmt;
@ -936,13 +951,12 @@ BookmarksStore.prototype = {
// fail, however, if the guid column does not exist. We fallback to just
// reading the annotation table in this case.
let stmt;
try {
if (this._haveGUIDColumn) {
stmt = this._getStmt(
"SELECT guid " +
"FROM moz_bookmarks " +
"WHERE id = :item_id");
}
catch (e) {
} else {
stmt = this._getStmt(
"SELECT a.content AS guid " +
"FROM moz_items_annos a " +
@ -983,13 +997,12 @@ BookmarksStore.prototype = {
// fail, however, if the guid column does not exist. We fallback to just
// reading the annotation table in this case.
let stmt;
try {
if (this._haveGUIDColumn) {
stmt = this._getStmt(
"SELECT id AS item_id " +
"FROM moz_bookmarks " +
"WHERE guid = :guid");
}
catch (e) {
} else {
stmt = this._getStmt(
"SELECT a.item_id AS item_id " +
"FROM moz_items_annos a " +

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

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

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

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