mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
Storage fixes
This commit is contained in:
@ -94,12 +94,13 @@ export class SqlStorage extends StorageEngine {
|
|||||||
* like SELECT, INSERT, and UPDATE.
|
* like SELECT, INSERT, and UPDATE.
|
||||||
*
|
*
|
||||||
* @param {string} query the query to run
|
* @param {string} query the query to run
|
||||||
|
* @param {array} params the additional params to use for query placeholders
|
||||||
* @return {Promise} that resolves or rejects with an object of the form { tx: Transaction, res: Result (or err)}
|
* @return {Promise} that resolves or rejects with an object of the form { tx: Transaction, res: Result (or err)}
|
||||||
*/
|
*/
|
||||||
query(query) {
|
query(query, ...params) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this._db.transaction((tx) => {
|
this._db.transaction((tx) => {
|
||||||
ts.executeSql(query, [], (tx, res) => {
|
ts.executeSql(query, params, (tx, res) => {
|
||||||
resolve({
|
resolve({
|
||||||
tx: tx,
|
tx: tx,
|
||||||
res: res
|
res: res
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* during low disk space situations.
|
* during low disk space situations.
|
||||||
*/
|
*/
|
||||||
export class Storage {
|
export class Storage {
|
||||||
constructor(strategyCls: StorageEngine) {
|
constructor(strategyCls: StorageEngine, options) {
|
||||||
this._strategy = new strategyCls();
|
this._strategy = new strategyCls(options);
|
||||||
}
|
}
|
||||||
get(key) {
|
get(key) {
|
||||||
return this._strategy.get(key);
|
return this._strategy.get(key);
|
||||||
|
Reference in New Issue
Block a user