OK, I relplied a bit in a hurry and didnt make myself clear. That is
stupid of me, and I am sorry.
The situation is like so. I open a connection using OpenAsync. I have
listeners listening to the Open event. When that is fired, I response
with a method that creates 3 tables in one go, see code below. I keep
getting an error, also shown below. If in the whole story I use open
instead of openAsync, everything works perfect. I have now idea why that
is??
<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>
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();
}
Muzak wrote:
Then I'm not sure I understand what your problem is.
You said it works when using openAsync()..
<quote>
The weird thing is that when I use openAsync instead of open, it does work?
</quote>
----- Original Message ----- From: "Jiri Heitlager"
<[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, April 17, 2008 10:52 PM
Subject: Re: [Flashcoders] Question AIR Sqlite api
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
_______________________________________________
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