Passing an Array into Titanium.Database.DB.execute
This does not seem to work. Crashes my app:
var conn = Titanium.Database.install('foo.db', 'foo');
var resultSet = conn.execute(
'SELECT * FROM BAR WHERE id=? and id2=?',
[1,2]
);
The following syntax does work, but shouldn't the above work as well?
var conn = Titanium.Database.install('foo.db', 'foo');
var resultSet = conn.execute(
'SELECT * FROM BAR WHERE id=? and id2=?',
1,
2
);
6 Answers
-
I think it should be array of objects.
[{id:1},{id2:2}]. -
Try using open on your DB rather than install
-
Is there anything else in your code that is causing the crash?
-
To pass in multiple arguments, you can simply keep adding them to the function call, as in this example.
-
Ticket #2917 has been opened to correct the docs.
However, check out the substitution examples in the SQLite Databases guide, which are correct.
-
I also have this problem. I there any chance we will see a fix for this any time soon?