ExecDMLTransaction

Bumbulla

Active Member
Hey

as shown in the sample script, im using the execdmltransaction method to put some datas in the db. So far so good, but once the script is finnished and im trying to start the script again, it'll tell me "cannot start a transaction within a transaction".
Strange thing is, im using this method multiple times in my script, all other parts where im using it are running fine, but just this part will give out the error once i ran the script a 2nd time.

Here's the part im using:

variable index:string DML

DML:Insert["UPDATE x Set sample1 = '${xxx}' WHERE ID = '${id}';"]
DML:Insert["UPDATE y Set sample2 = '${yyy}' WHERE ID = '${id}';"]
DML:Insert["UPDATE z Set sample3 = '${zzz}' WHERE ID = '${id}';"]


db_sample:ExecDMLTransaction[DML]
Anyone got an idea what im doing wrong?
 

pr517

Active Member
It sounds like it isn't doing "END TRANSACTION" at the end of the transaction likely from either broken statements causing a break or interfering parallel transactions. So at the beginning of a new transaction it does another "BEGIN TRANSACTION" but it is still in that stage. Are you sure that the statements are legit (valid fields, acceptable values, etc.)? Is a previous transaction still being carried out?
 

Amadeus

The Maestro
Staff member
Yes, try replacing all your variables with actual values and test it and see if that fixes it. You probably have a statement somewhere that is an issue.
 

Bumbulla

Active Member
Once the server is back up im going to test if all datas are valid. But as i said im using the same method only a few codelines later and it is working fine there. Dunno what might be wrong.
 

Bumbulla

Active Member
Checked it now - all datas are valid and even if i replace the vars with static values its still gonna give me the same error after the first script run.
 

Amadeus

The Maestro
Staff member
I would have to see the entire script to have more help.

You are closing the database once your script ends, right?
 

Bumbulla

Active Member
Yes db will be closed once script finished.
Right now im even more clueless tho. If im running the script a 2nd time it'll say now that db is still locked but there is no other threat trying to access it. (And all i changed is that i took those 3 update statements into one query coz its the same table anyways.)
 

Amadeus

The Maestro
Staff member
Again, I would have to see the script to know where the bug lies. The sample script I provide does what you're describing and does not have that bug.
 

Bumbulla

Active Member
Hey its me again. :)

Havnt had any time last weeks. Trying to give a clear update on the situation:

I tested exactly the same script with just a few (4) database entrys on another character. 1st run went fine so i tried to run it a 2nd time. Console told me that i cant run the script again coz its still/again running. Whatever that caused, for now i simply avoided it with manually ending the script (ends scriptname). Now i ran the script a 2nd and 3rd time without problems at all. *happy*
So i went back on my main botting char and tested the same with my "original" database with like 500 entrys. First run went thru without any problems. Tried to start the script again - same error as above, script still running. Same procedure as above and finally started the 2nd run. 3 Querys were done fine - 4th query caused a client freeze of 2minutes and ended in an error msg "[sqlite] <ERROR> (5) SQLiteDB.ExecDMLTransaction:: Error ending SQLite Transaction. (Error: 5:SQLITE_BUSY[5]: database is locked)".
I aborted the running script and asking what that might have caused. As it seems (first run) the script is working as intended. (?)

Im more a hobby coder tho and my script might simply look horrible for you guys - but if you wanna see it, tell me. (Aslong as you dont rape me. :) )

//Update

Tested a reduced database down to just 1 entry on my main botting char - after the first run the same error (db locked). Went back on one of my alts and tested the db there - no problems. How can it be char located? Im confused.
 
Last edited:
Top Bottom