weird...I will have to look into that and see if there is a work around,
because I would really like to work with openAsync.
J.
Muzak wrote:
Because when adding listeners you are implying asynchronous mode.
In other words, as soon as you add listeners, you have to use openAsync().
I've found the use of synchronous mode to be alot easier.
regards,
Muzak
----- Original Message ----- From: "Jiri Heitlager"
<[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, April 16, 2008 5:02 PM
Subject: [Flashcoders] Question AIR Sqlite api
I have a question about SQLite and AIR. Does anybody know why I get
this error, becuase the connection is open? I put the code below. The
weird thing is that when I use openAsync instead of open, it does work?
<error>
Error: Error #3105: Operation is only allowed if a connection has an
open transaction.
at Error$/throwError()
at flash.data::SQLConnection/commit()
at
classes.models::SQLProxy/createDatabase()[/Users/Jiri/Documents/_Flash/SmsApp/SmsApplication/src/classes/models/SQLProxy.as:128]
Debug session terminated.
</error>
<code>
protected function build():void
{
Sql_db = File.applicationDirectory.resolvePath('TESTER.db')
var exists:Boolean = Sql_db.exists
if ( exists ) {
Sql_conn.addEventListener(SQLEvent.OPEN , onDBStatementOpenResult);
}else {
Sql_conn.addEventListener(SQLEvent.OPEN , createDatabase);
}
Sql_conn.openAsync( Sql_db )
}
private function createDatabase(e:Event):void
{
Sql_conn.addEventListener(SQLEvent.COMMIT , onDatabaseCreated);
Sql_conn.begin();
var createTable:SQLStatement = new SQLStatement()
createTable.sqlConnection = Sql_conn
createTable.text = 'CREATE TABLE contacts (index_id INTEGER PRIMARY
KEY , name TEXT , phone NUMBER )';
createTable.execute();
var createErrors:SQLStatement = new SQLStatement()
createErrors.sqlConnection = Sql_conn
createErrors.text = 'CREATE TABLE errors (index_id INTEGER PRIMARY KEY
, error_id INTEGER , type TEXT )';
createErrors.execute();
var createArchive:SQLStatement = new SQLStatement()
createArchive.sqlConnection = Sql_conn
createArchive.text = 'CREATE TABLE sms_archive (index_id INTEGER
PRIMARY KEY , sms TEXT , receiver NUMBER , sender NUMBER )';
createArchive.execute();
Sql_conn.commit();
}
</code>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders