I want to add items to [string]. But the following code fails at param.push statement.
EDIT
declare var sqlitePlugin:any;
var query: string = `SELECT * FROM items `;
var param: [string];
if (options['limit']) {
var limit = options['limit'];
query = query + " LIMIT ? ";
param.push(String(limit));
}
if (options['offset']) {
var offset = options['offset'];
query = query + " OFFSET ? ";
param.push(String(offset));
}
sqlitePlugin.openDatabase({name: 'Items.db', key: 'Password', location: 'default'}, (db) => {
db.transaction((tx)=> {
tx.execQuery(query, param, (resultSet)=>{
this.items = [];
for(let i = 0; i < resultSet.rows.length; i++) {
var item: Item = new Item();
item.code = resultSet.rows.item(i).item_code;
item.name = resultSet.rows.item(i).item_name;
this.items.push(item);
}
callback(this.items);
} );
}
});
Sorry to ask this very basic question but I'm struggling for 2 days.. Please give me any hint or link.
Thanks in advance.