Hi,
I have one database with two tables, for executing those two tables, can I create two separate variables or one variable is enough?
can I follow like this,
var db = Titanium.Database.install('mydata.sqlite','maintable','mycheck');
or
var db1 = Titanium.Database.install('mydata.sqlite','maintable'); var db2 = Titanium.Database.install('mydata.sqlite','mycheck');
2 Answers
Why do you want to create 2 databases? the database.install method is just a way of making a copy of your sqlite database to your device. So the first parameter is your SQLITE file and the second variable is how the db is called on your device (This has no use for you)
//mydata.sqlite = sqlite file //db = how it will be called on your device when it makes a copy var db1 = Titanium.Database.install('mydata.sqlite','db');So if you would do
var db1 = Titanium.Database.install('mydata.sqlite','maintable'); var db2 = Titanium.Database.install('mydata.sqlite','mycheck');You'd be installing the same database twice.
You don't understand, read documentation.
"Install" method installs database, second parameter is database name, while first is sqlite file to populate database with tables and data.
So, install database and then use SQL to get data from database tables.
Your Answer
Think you can help? Login to answer this question!