Saturday, October 22, 2011

How to know does a table exist in Adobe AIR SQLite


public function doesTableExist(connection:SQLConnection, tableName:String):Boolean{
    connection.loadSchema();
    var schema:SQLSchemaResult = connection.getSchemaResult();

    for each (var table:SQLTableSchema in schema.tables)
    {
        if (table.name.toLowerCase() == tableName.toLowerCase())
        {
            return true;
        }
    }
    return false;
}

source

No comments:

Freelance