As always lets do things in steps.
- Create necessary variables.
- Open connection to database file already created.
- Read schema from opened connection to database.
1. Create necessary variables
private var sqlConnection:SQLConnection; private var dbFile:File; private var sqlStatement:SQLStatement;
2. Open connection to database file already created
dbFile=new File();
dbFile=File.applicationStorageDirectory.resolvePath("myDatabase.db");
sqlConnection = new SQLConnection();
sqlConnection.addEventListener(SQLEvent.OPEN, onDBOpened);
sqlConnection.addEventListener(SQLErrorEvent.ERROR, onDBError);
sqlConnection.open(dbFile);
3. Read schema from opened connection to database
//event handler for SQLEvent.OPEN
private function onDBOpened(event:SQLEvent):void
{
if (event.type == "open")
{
//successfully opened database connection
//below statement loads schema
sqlConnection.loadSchema();
//below statement to access the schema
var sqlSchemaResult:SQLSchemaResult=sqlConnection.getSchemaResult();
//below statement returns all tables from loaded schema result that is array of SQLTableSchema
var tables:Array=sqlSchemaResult.tables;
for each(var sqlTableSchema:SQLTableSchema in tables)
{
trace("Table name:"+sqlTableSchema.name);
trace("Columns:"+sqlTableSchema.columns);
//can explore SQLTableSchema Class for more.
}
}
}
Hi People, Its been a while i blogged, trying to make it back and hope this post helps someone.

Pingback: Load schema and access the loaded schema of database in SQLite, AIR. | flex on blog - by Kumar | Everything about Flash | Scoop.it
Pingback: Load schema and access the loaded schema of database in SQLite, AIR. | flex on blog – by Kumar « eaflash
Thank you. I have been trying to figure out how to use SQLSchema without much luck and your post was very helpful. Thanks again