Raw-SQL

patrick:
The problem about locking here is this:

if the connection you are using locks a record for whatever reason (usually due to a transaction) and you then fire a sql to such a locked record, you are “dead”. The reason for this is that the SQL plugin uses its own connection for its stuff, so the database correctly refuses any changes to those records until the lock is released.

Then you are dead-locked. Your method fires a statement to a record that was locked by your method before and waits until that is finished. That can take a while :wink:

I have run into the same situation several times and already discussed this with Jan Blok. I think the behaviour would probably improve if the same connection was used. Then the database will allow any statement on locked records, because the lock comes from the same session as the statement is using. So maybe we should emphasize this wish and move this to the feature request section…

Thankx…this solved the problem…the rawSQL-pluging was indeed deleting rows when Servoy had a transaction.
I personally find this tricky stuff and am not sure if working this way with the plugin is a good idea (like Marcel also said…it could be tricky). Is there any way you can ask thru the rawSQL plugin if there are any transactions?

If you don’t know if you have started a transaction or not yourself, you are in deep trouble anyway!

But instead of using the plugin you can simply do:

databaseManager.hasTransaction()

patrick:
If you don’t know if you have started a transaction or not yourself, you are in deep trouble anyway!

gegege…yeah…well I know when there is an transaction, but I can imagina situations (for example if 2 clients are working on the same rows) that one client could lock a record for the other client.

patrick:
But instead of using the plugin you can simply do:
databaseManager.hasTransaction()

Life can be so simple sometimes…thankx…forgot about that one :roll:

tweetie:
for example if 2 clients are working on the same rows that one client could lock a record for the other client.

If there really is a lock, two clients can never “work” on the same rows, so that will not happen. You only have to take care about the one client you are currently dealing with.

patrick:

tweetie:
for example if 2 clients are working on the same rows that one client could lock a record for the other client.

If there really is a lock, two clients can never “work” on the same rows, so that will not happen. You only have to take care about the one client you are currently dealing with.

I ment that one client could lock a row (thru Servoy), and another client could try to delete the same row thru the rawSQL plugin