haxe/openfl sqlite problem

56 views
Skip to first unread message

Jocala Jocala

unread,
May 5, 2014, 12:49:51 PM5/5/14
to haxe...@googlegroups.com
The android-targeted code below compiles but crashes. A logcat shows nothing useful that I see. All I'm trying to do at this point is create and initialize a db. I'm not yet checking to see if it exists,etc.


package mygame;

     <snip imports>

    import sys.db.Types;

    class ScoreDB extends sys.db.Object {
        public var id : SId;
        public var dbscore1 : SInt;
        public var dbsound  : SInt;
        public var dbscore2 : SInt;
    }

    class mygame extends Sprite {

            <snip var defines>

      public function new () {

             // start sqlite code
             sys.db.Manager.initialize();


     // db does exist
    //  then read values
   //  currentScore = score1.dbscore1;
   //  doSound = score1.dbsound;
   //  doScore = score1.dbscore2;

    // db does not exist:

    var cnx = sys.db.Sqlite.open("mybase.db");
    sys.db.Manager.cnx = cnx;
    sys.db.TableCreate.create(ScoreDB.manager);

        var score1 = new ScoreDB();
        score1.id = 0;
        score1.dbscore1 = 0;
        score1.dbsound  = 0;
        score1.dbscore2 = 0;
        score1.insert();

        currentScore = 0;
        doSound = 0;
        doScore = 0;


        cnx.close();

        // end sqlite code

     super ();
     initialize ();
     construct ();
     newGame ();


 }
Reply all
Reply to author
Forward
0 new messages