Ionic 2 SqlStorage iOS SELECT doesn't return data

I’ve recently started developing an app using Ionic 2 because of it’s out-of-the-box support of SqlStorage.

The SqlStorage implementation works great for Ionic Serve and the Android Emulator but not on iOS.

The SqlStorage implementation on iOS works to the point where you can create the tables and insert some data but I can’t seem to retrieve any data with a simple SELECT statement such as:

storage.query('SELECT * FROM box WHERE boxHidden = ?', [0]).then((resp) => {

From this query I am only getting back the following resultset:

"tx": {
	"db": {
		"openargs": {
"res": {
	"rows": {

As opposed to Android where I am getting a resultset with an arraly of data with 3 objects and the length element.

Has anybody got a similar experience and knows how to approach/solve this?

Thank you very much in advance.

Best regards,

I am getting similar issue…did u managed to fix this?

I use resp.res.rows and resp.res.rows.item(x) to get the data across all devices.

1 Like

Thanks, that was the answer I was going to type if nothing was here yet.

In order to receive the data for the rows in iOS (and Android as well) you always need to use the resp.res.rows.item(x) function by looping through the results (resp.res.rows.length) with a for-loop.

When using that function you can use resp.res.rows.item(x).fieldName to fetch the fields returned by the result-set.