Good question. I dont even know how to find that out. But i did download it less than a week ago, so it should be the current version. I did get it to work correctly though by adding a getter which i could reference.
The modified part of the class looks like this:
ActionScript Code:
private static var _instance:DatabaseConnector;
private var _conn:SQLConnection;
public function get database():SQLConnection {
return _conn;
}
public function DatabaseConnector(enforcer:SingletonEnforcer) {
trace("i have initialized");
var conn:SQLConnection = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
var dbFile:File = File.applicationStorageDirectory.resolve("mydatabase.sqlite");
conn.open(dbFile, false);
_conn = conn;
}
And now i reference by calling the database property DatabaseConnector.getInstance().database
If there is a more efficient way of doing this, please don't hold back.
Another thing. The database i am accessing i created using SQLiteManager but AIR doesn't seem to like it. I don't get any errors connecting to it, but i presume this is because my code creates a new database if one doesn't already exist. So this would explain when i try to access a table in the generated db that i receive an error saying the table cannot be found.
I would like to be able to include a separate database with my app, just so its easier to for people to make backups or be able to access it through other applications. Any ideas on why i am unable to use a pre-defined database?
Thanks!!!