Titanium Community Questions & Answer Archive

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

Database INSERT

Hi everyone.

I've created a history.db and sampled a script from the Kitchen Sink to read it which works.

But I'm having trouble inserting a new row. the code below does'nt seem to be working:

var urlvalue = "http://someurl.com";
var db = Titanium.Database.open('history.db','urlHistory');

db.execute('CREATE TABLE IF NOT EXISTS urlHistory 
(urlID INTEGER, url TEXT, dtime DATETIME DEFAULT CURRENT_TIMESTAMP)');

db.execute('INSERT INTO urlHistory (url) VALUES(?)' ,urlvalue);

I read that I didn't need a urlID as it will autoincrement and the current timestamp will update also, therefore just need to insert the URL of that the user passes through my form.

Any ideas?

Many thanks

— asked April 29th 2010 by Craig Jones
  • database
  • insert
0 Comments

1 Answer

  • DATE/DATETIME badly supported at the moment

    https://appcelerator.lighthouseapp.com/projects/25719/tickets/290-titaniumdatabase-does-not-support-the-date-data-type

    And be really careful about the data type used when you create your table.
    https://appcelerator.lighthouseapp.com/projects/25719/tickets/296-select-statements-failing-using-synchronous-db

    — answered April 29th 2010 by Franck T
    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.