Getting empty resultset in database execute

You must Login before you can answer or comment on any questions.

in app.js

Titanium.Database.install('highScores.sqlite','highScoresDB');
in scores.js
var db = Titanium.Database.open('highScoresDB');
var scores = db.execute('select * from scores');
Ti.API.info(scores.rowCount);
console prints 0! In SQLite manager firefox add-on I have the results I want like this: screenshot

The .sqlite file in resources is also updated and not empty.

Any recommendations? Is there something wrong with the code?

3 Answers

For me the same rowCount returns only 0, seems to be a problem with that. You can count rows in sql

SELECT *, count(*) FROM scores
and acces that value, seems to be the simple workaround for that.

Delete the app from Simulator/device and try again. Resource db != device db.

You are not getting proper result because your database name is highScores and in open function you need to pass the name of database

var db = Titanium.Database.open('highScores');

Your Answer

Think you can help? Login to answer this question!