mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 583847 - Weave should be using createAsyncStatement instead of createStatement [r=mconnor]
This commit is contained in:
parent
5a745d9fdb
commit
76e998252a
@ -851,10 +851,12 @@ BookmarksStore.prototype = {
|
||||
get _frecencyStm() {
|
||||
if (!this.__frecencyStm) {
|
||||
this._log.trace("Creating SQL statement: _frecencyStm");
|
||||
this.__frecencyStm = Svc.History.DBConnection.createStatement(
|
||||
this.__frecencyStm = Utils.createStatement(
|
||||
Svc.History.DBConnection,
|
||||
"SELECT frecency " +
|
||||
"FROM moz_places " +
|
||||
"WHERE url = :url");
|
||||
"WHERE url = :url " +
|
||||
"LIMIT 1");
|
||||
}
|
||||
return this.__frecencyStm;
|
||||
},
|
||||
@ -868,14 +870,10 @@ BookmarksStore.prototype = {
|
||||
|
||||
// Add in the bookmark's frecency if we have something
|
||||
if (record.bmkUri != null) {
|
||||
try {
|
||||
this._frecencyStm.params.url = record.bmkUri;
|
||||
if (this._frecencyStm.step())
|
||||
index += this._frecencyStm.row.frecency;
|
||||
}
|
||||
finally {
|
||||
this._frecencyStm.reset();
|
||||
}
|
||||
this._frecencyStm.params.url = record.bmkUri;
|
||||
let result = Utils.queryAsync(this._frecencyStm, ["frecency"]);
|
||||
if (result.length)
|
||||
index += result.frecency;
|
||||
}
|
||||
|
||||
return index;
|
||||
|
@ -110,7 +110,7 @@ let FormWrapper = {
|
||||
createStatement: function createStatement(query) {
|
||||
try {
|
||||
// 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) {
|
||||
// Assume guid column must not exist yet, so add it with an index
|
||||
@ -121,7 +121,7 @@ let FormWrapper = {
|
||||
"ON moz_formhistory (guid)");
|
||||
|
||||
// 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];
|
||||
|
||||
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() {
|
||||
|
@ -146,6 +146,15 @@ let Utils = {
|
||||
throw batchEx;
|
||||
};
|
||||
},
|
||||
|
||||
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) {
|
||||
// Allow array of names, single name, and no name
|
||||
|
Loading…
x
Reference in New Issue
Block a user