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
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