Titanium.Database doesn't work !?
sqlite datebase (3.5.9) :
smsovh.db created in command line in my Resources directory (on Linux).
main is the database name.
access is the table name.
access contains 1 row.
Code :
var main = Titanium.Database.install('smsovh.db','main');
var db = Titanium.Database.open('main');
var rows = db.execute('SELECT * FROM access');
if(rows.isValidRow())
{
Titanium.API.info('OK');
}
When i launch Android Emulator :
Runtime Error - TypeError: Cannot call method "isValidRow" of null
Why it's null where is my problem ?
Thanks
2 Answers
-
Hello,
Your exact code works fine for me – I get the "OK" in the console and no runtime error.
Like you, I created the file first using sqlite3 (3.5.9). I'm using Titanium Mobile SDK 1.2.0. I launched in Android 2.1 with APIs. My setup is OS X Snow Leopard.
Regards,
Bill
-
Firstly, you don't have to open() - install() will return a DB handle. Secondly, turn on trace mode and look for the db error you're getting.