Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked April 21st 2010 by Dorchies Philippe
  • android
  • database
  • error
  • isvalidrow
0 Comments

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

    — answered April 21st 2010 by Bill Dawson
    permalink
    0 Comments
  • 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.

    — answered April 22nd 2010 by Damien Elmes
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.