зеркало из https://github.com/mozilla/gecko-dev.git
Bug 616001 follow-up: Async statements are compiled asynchronously and fail on first execution, not creation. r=sdwilsh
This commit is contained in:
Родитель
1e0438cf6d
Коммит
91b699daac
|
@ -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 " +
|
||||
|
|
Загрузка…
Ссылка в новой задаче