• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

[Burrito] Connect to SQLite DB

New Here ,
Dec 09, 2010 Dec 09, 2010

Copy link to clipboard

Copied

Hi All,

Im having a hell of a time trying to create/connect to a local database (SQLite) on Android 2.2 HTC Evo.

I began by creating the database on the fly at startup if one didnt exist. This works like a champ on a Windows machine, but wont create the database on the SDCard. Man, the lack of docs is killing me. Can someone give me some insight or a work around the this?

Thanks,

Stephan

--------------------------------------------------------------------------------------------------------------

Example Part 1:

      import flash.data.SQLConnection;

    public var conn:SQLConnection = new SQLConnection();
    public var thisPath:String;

    private function checkDatabase():void
    {
        var db:File = File.desktopDirectory.resolvePath('TechConnect.db');
       
        thisPath = db.nativePath.toString();
        trace(db.nativePath.toString());
        if(!db.exists)
        {
            conn.addEventListener(SQLEvent.OPEN,connOpenHandler);
            conn.addEventListener(SQLErrorEvent.ERROR,connErrorHandler);
            conn.openAsync(db);
        }
    }
   
    private function connOpenHandler(event:SQLEvent):void
    {
        trace("the database was created successfully");
        if(conn.connected)
        {
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = conn;
            var sql:String = "CREATE TABLE [tablename] (my fields here.....)";
            stmt.text = sql;
            stmt.execute();
        }
       
    }
   
    private function connErrorHandler(event:SQLErrorEvent):void
    {
        trace("Error message:", event.error.message);
        trace("Details:", event.error.details);
    }

--------------------------------------------------------------------------------------------------------------

Views

574

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 05, 2011 Jan 05, 2011

Copy link to clipboard

Copied

LATEST

Since this query is more pertinent to the SDK, it is better posted here http://forums.adobe.com/community/flex/flex_general_discussion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines