Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old September 19th, 2007, 06:01 AM
ChrisRob300 ChrisRob300 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Location: Romford UK
Posts: 2 ChrisRob300 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 54 sec
Reputation Power: 0
Send a message via Skype to ChrisRob300
Smile Firebird 1.5 / 2.0 Deadlocks

Hi

Can anyone point me in the direction of some example code for
Firebird 1.5/2.0 as I am getting a "Deadlock" error when using the SQL Update command from inside my app, when run multi-user.

I need to run a transaction. I also have triggers with update code in the trigger. This also deadlocks.

Is there a HowTo to get this working? I am using Delphi 7.

Thanks

Chris

Reply With Quote
  #2  
Old September 19th, 2007, 06:17 AM
pabloj's Avatar
pabloj pabloj is online now
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,707 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 3 h 1 m 35 sec
Reputation Power: 259
You'd better Google (for the tutorial only) or show us your logic and a meaningful example if you are looking for advice

Reply With Quote
  #3  
Old September 20th, 2007, 04:32 AM
ChrisRob300 ChrisRob300 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Location: Romford UK
Posts: 2 ChrisRob300 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 54 sec
Reputation Power: 0
Send a message via Skype to ChrisRob300
I am using Delphi 7, Firebird 2 and BDE
If I run the following code on 2 client PCs at the same time I get a
"Deadlock" error.

for count := 1 to 10 do
begin
quTemp.sql.clear;
quTemp.sql.add( 'update PRODUCT set' );
quTemp.sql.add( 'PRICE=:Price' );
quTemp.sql.add( 'where PRODUCTCODE=:ProductCode' );
quTemp.parambyname('Price').AsFloat := 10;
quTemp.parambyname('ProductCode').AsInteger := 1;
quTemp.ExecSQL;
end;

I have only placed the update in a loop to insure a conflict everytime I run
the test program.
However I created this program because my main application was also having
the same problem intermittently when posting only once.

I have tried to find a way to set the Transaction to "wait" for any other
transactions to complete before attempting to start but nothing seems to
have any effect.

I have also tried using Interbase Express components to go around the BDE
but this also made no difference.

Any help you can give me would be very gratefully received.

Chris

Reply With Quote
  #4  
Old September 20th, 2007, 10:29 AM
pabloj's Avatar
pabloj pabloj is online now
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,707 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 3 h 1 m 35 sec
Reputation Power: 259
That's normal behaviour, you should simply catch the error and tell the user that the record is already in use by someone else.
Or you can alter the transaction isolation level (see here ) but I's unsafe

Reply With Quote
  #5  
Old April 22nd, 2008, 06:45 AM
dirinler dirinler is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 13 dirinler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 25 sec
Reputation Power: 0
hmm sure i have an idea if you use the ibtable etc then you can create a code then you can catch it with ibevent
as an exam when a user edit on the record then you can check it and showmessage('record cant to be edit mode etc');

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Firebird 1.5 / 2.0 Deadlocks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway