зеркало из https://github.com/mozilla/gecko-dev.git
Bug 583847 - Weave should be using createAsyncStatement instead of createStatement [r=mconnor]
This commit is contained in:
Родитель
5a745d9fdb
Коммит
76e998252a
|
@ -851,10 +851,12 @@ BookmarksStore.prototype = {
|
||||||
get _frecencyStm() {
|
get _frecencyStm() {
|
||||||
if (!this.__frecencyStm) {
|
if (!this.__frecencyStm) {
|
||||||
this._log.trace("Creating SQL statement: _frecencyStm");
|
this._log.trace("Creating SQL statement: _frecencyStm");
|
||||||
this.__frecencyStm = Svc.History.DBConnection.createStatement(
|
this.__frecencyStm = Utils.createStatement(
|
||||||
|
Svc.History.DBConnection,
|
||||||
"SELECT frecency " +
|
"SELECT frecency " +
|
||||||
"FROM moz_places " +
|
"FROM moz_places " +
|
||||||
"WHERE url = :url");
|
"WHERE url = :url " +
|
||||||
|
"LIMIT 1");
|
||||||
}
|
}
|
||||||
return this.__frecencyStm;
|
return this.__frecencyStm;
|
||||||
},
|
},
|
||||||
|
@ -868,14 +870,10 @@ BookmarksStore.prototype = {
|
||||||
|
|
||||||
// Add in the bookmark's frecency if we have something
|
// Add in the bookmark's frecency if we have something
|
||||||
if (record.bmkUri != null) {
|
if (record.bmkUri != null) {
|
||||||
try {
|
this._frecencyStm.params.url = record.bmkUri;
|
||||||
this._frecencyStm.params.url = record.bmkUri;
|
let result = Utils.queryAsync(this._frecencyStm, ["frecency"]);
|
||||||
if (this._frecencyStm.step())
|
if (result.length)
|
||||||
index += this._frecencyStm.row.frecency;
|
index += result.frecency;
|
||||||
}
|
|
||||||
finally {
|
|
||||||
this._frecencyStm.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
|
|
@ -110,7 +110,7 @@ let FormWrapper = {
|
||||||
createStatement: function createStatement(query) {
|
createStatement: function createStatement(query) {
|
||||||
try {
|
try {
|
||||||
// Just return the statement right away if it's okay
|
// Just return the statement right away if it's okay
|
||||||
return Svc.Form.DBConnection.createStatement(query);
|
return Utils.createStatement(Svc.Form.DBConnection, query);
|
||||||
}
|
}
|
||||||
catch(ex) {
|
catch(ex) {
|
||||||
// Assume guid column must not exist yet, so add it with an index
|
// Assume guid column must not exist yet, so add it with an index
|
||||||
|
@ -121,7 +121,7 @@ let FormWrapper = {
|
||||||
"ON moz_formhistory (guid)");
|
"ON moz_formhistory (guid)");
|
||||||
|
|
||||||
// Try creating the query now that the column exists
|
// Try creating the query now that the column exists
|
||||||
return Svc.Form.DBConnection.createStatement(query);
|
return Utils.createStatement(Svc.Form.DBConnection, query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -119,7 +119,7 @@ HistoryStore.prototype = {
|
||||||
return this._stmts[query];
|
return this._stmts[query];
|
||||||
|
|
||||||
this._log.trace("Creating SQL statement: " + query);
|
this._log.trace("Creating SQL statement: " + query);
|
||||||
return this._stmts[query] = this._db.createStatement(query);
|
return this._stmts[query] = Utils.createStatement(this._db, query);
|
||||||
},
|
},
|
||||||
|
|
||||||
get _haveTempTablesStm() {
|
get _haveTempTablesStm() {
|
||||||
|
|
|
@ -147,6 +147,15 @@ let Utils = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createStatement: function createStatement(db, query) {
|
||||||
|
// Gecko 2.0
|
||||||
|
if (db.createAsyncStatement)
|
||||||
|
return db.createAsyncStatement(query);
|
||||||
|
|
||||||
|
// Gecko <2.0
|
||||||
|
return db.createStatement(query);
|
||||||
|
},
|
||||||
|
|
||||||
queryAsync: function(query, names) {
|
queryAsync: function(query, names) {
|
||||||
// Allow array of names, single name, and no name
|
// Allow array of names, single name, and no name
|
||||||
if (!Utils.isArray(names))
|
if (!Utils.isArray(names))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче