Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

SQLite openAsync & loadSchema

$
0
0

Hi,

 

I'm having trouble gathering schema information from a database i've opened asyncronously.

 

I get the error Error #2044: Unhandled SQLErrorEvent:. errorID=3115, operation=schema , message=Error #3115: SQL Error. , details=No schema objects in database 'main' were found

 

I do not encounter this problem when using syncronous database with open().

 

Database contains one table with around 10,000 records. Standard SQL querys against the database work fine, I just cant get the schema

 

Here's my code.

 

package com.roleready {
    import flash.data.SQLConnection;
    import flash.data.SQLMode;
    import flash.data.SQLSchema;
    import flash.errors.SQLError;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    import flash.net.Responder;
   
    public class DBTest {
       
        private var dbFile:File = File.applicationStorageDirectory.resolvePath('roleready.db3');
       
        private var conn:SQLConnection;
       
        private var _responder:Responder;
       
        public function DBTest():void {
            _responder = new Responder(resultEventHandler, errorEventHandler);
            conn = new SQLConnection();
            conn.openAsync(dbFile, SQLMode.UPDATE, _responder);
        }
       
        private function resultEventHandler(event:SQLEvent):void {
            switch(event.type){
                case SQLEvent.OPEN:        // database opened
                    trace("Database connected");
                    conn.addEventListener(SQLEvent.SCHEMA, resultEventHandler);
                    conn.loadSchema();
                    break;
                case SQLEvent.SCHEMA:    // schema received
                    trace("Got db schema");
                    break;
                default:
                    trace("Unhandled result event:", event.type);
                    break;
            }
        }
       
        private function errorEventHandler(error:SQLError):void {
            trace(error);
        }
       
    }
}

 

Any suggestions?


Viewing all articles
Browse latest Browse all 21156

Trending Articles