I am using the below code in two different Action script
var dbFile1:File = File.applicationStorageDirectory.resolvePath("sheduler.db"); //Creating the database sheduler.db
sqlc.addEventListener(SQLEvent.OPEN, dbFile_opened );
i am pointing to the same database from other action script......
var dbFile2:File = File.applicationStorageDirectory.resolvePath("sheduler.db");
The Problem is database is getting created twice.... i.e each time when i use resolvepath.....
where i am going wrong can u pls let me know....
Pls make me clear in what situations to use open and openAsync for database in sqlite
Thanks & Regards
Well. I guess you have to use singleton to get the connection of the DB. Yes, You are trying to create the DB twice by using the same line of code in two different places. Please get the connection, distrubute the connection to the whole application by putting it in the singleton.
In the above link, the author used sqlConnection, You have to provide the whole application with this connectoin in a singleton.
Its like saisri2k2 say, you need use a singleton to keep the connection with your database.
Do you know about FlexORM? Is a great framework to persist objects using SQLite in Flex.
To see more about FlexORM visit: http://flexorm.riaforge.org/