PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: eball on April 20, 2009, 07:31:29



Title: SQLite compound INSERT
Post by: eball on April 20, 2009, 07:31:29
Has anyone been successful at using compound INSERTS with SQLite.
Just cant get it work.

I tried a single long query with multiple INSERT tags, but cant get that to work when coming from AS3. If i copy the long query straight into SQLite Admin and run the query there, it works perfect.

Right now i have to loop thru each insert with a new sql class and connection per one.
Unfortunately, after about 430 records, it stops.

All my other SQLite tags are working fine (single INSERT, DELETE, CREATE, SELECT, etc)
Any help would be greatly appreciated.


Title: Re: SQLite compound INSERT
Post by: Ondina on April 21, 2009, 12:23:56
My first thought about your question was: why don't you use transactions?

My guess is that your SQLite Admin (which one are you using?) is grouping your statements  into a  transaction.
It probably makes an array out of your statements and loops through them inside a transaction.
That's probably why your “long query” works in there.

If you simply add a statement after another and try to execute() them all together it wont work, because, as far as I know, only one statement is executed at a time. I would suggest you use transactions.

Right now i have to loop thru each insert with a new sql class and connection per one.
Unfortunately, after about 430 records, it stops.

Can you say more about this?  Are you inserting the records into the same table, or are there different tables? Were you using asynchronous or synchronous connections?

Ondina


Title: Re: SQLite compound INSERT
Post by: eball on April 21, 2009, 02:24:56
I tried Transactions last night but was doing it wrong.
Per your suggestion, I tried it again and got it work.
Thanks a bunch.