sqlStorage not return all results


#1

I’m developing an ionc 2 app with pre-configured database with multiple records in a table called products.

When I run a query as below, not all results are returned.

var param = [’%’ + name + ‘%’];
this.storage.query(SELECT * FROM products WHERE Name LIKE (?), [param]).then((data) => { …

When I check the database file .db using the program “DB Browser for SQLite” file, there are 300 results, however, is only one is returned.

Could this be a problem in the plugin?

My system information:

Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.2
Gulp Local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
THE:
Node Version: v5.12.0

  • Plugins -

cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cord-plugin-device 1.1.2 "Device"
cordova-plugin-file 4.3.0 "File"
cordova-plugin-splashscreen 3.1.0 "Splashscreen"
cordova-plugin-2.1.3 statusbar "StatusBar"
cordova-plugin-1.2.2 whitelist "Whitelist"
cordova-sqlite-ext 0.10.1 "Cordova sqlite storage plugin extra with (xx dev branch version)"
cordova-sqlite-storage 1.4.7 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
me.rahul.plugins.sqlDB 1.0.3 “SQLDB”


#2

Were you able to get this working? I’m trying to get a pre-configured database as part of an application and am running into problems. If you got yours working would you be able to show some snippets on how you got your app setup or a good tutorial reference? I’m using the me.rahul.plugins.sqlDB and sqlite-storage like you are.


#3

I am not sure this is the problem but ,

You passing parameters like [param] where var param is already a string array I guess , [‘xyz’] like this ?

So its evaluating to [['xyz']]. I dont think sql can take params as array. It can be [‘xyz’] or [123] or [0].

Try this passing param only as a string.