Subject | Firebird 1.5 and Pessimistic Locking |
---|---|
Author | Marcel Brink |
Post date | 2003-10-16T22:49:42Z |
Hi,
For those who are interested in using the pessimistic Locking
mechanism of Firebird 1.5 with IBO I found the following
solution for not losing the "WITH LOCK" statement in a SELECT
statement.
I noticed a previous thread about this issue, but commenting
lines of source in not a solution IMHO.
When the following Method is changed everything works great,
also with the "WITH LOCK" Statement.
Package IBO40CRT.bpl Unit IB_Parse.
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
OLD Implementation :
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
var
TermKeyWord: string;
begin
BegPos := ParseLineInvalid;
EndPos := ParseLineEnd;
ParseStr( SQL,
'FOR', false,
[';'],
BegPos, EndPos, TermKeyWord, false, false );
end;
NEW Implementation :
Add "WITH" and "LOCK" to the TermKeys Array to pass in the
ParseStr Method.
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
var
TermKeyWord: string;
begin
BegPos := ParseLineInvalid;
EndPos := ParseLineEnd;
ParseStr( SQL,
'FOR', false,
['WITH', 'LOCK', ';'],
BegPos, EndPos, TermKeyWord, false, false );
end;
Marcel Brink
Xploration.
For those who are interested in using the pessimistic Locking
mechanism of Firebird 1.5 with IBO I found the following
solution for not losing the "WITH LOCK" statement in a SELECT
statement.
I noticed a previous thread about this issue, but commenting
lines of source in not a solution IMHO.
When the following Method is changed everything works great,
also with the "WITH LOCK" Statement.
Package IBO40CRT.bpl Unit IB_Parse.
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
OLD Implementation :
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
var
TermKeyWord: string;
begin
BegPos := ParseLineInvalid;
EndPos := ParseLineEnd;
ParseStr( SQL,
'FOR', false,
[';'],
BegPos, EndPos, TermKeyWord, false, false );
end;
NEW Implementation :
Add "WITH" and "LOCK" to the TermKeys Array to pass in the
ParseStr Method.
procedure FindSQLForUpdate( const SQL: string; var BegPos, EndPos:
longint );
var
TermKeyWord: string;
begin
BegPos := ParseLineInvalid;
EndPos := ParseLineEnd;
ParseStr( SQL,
'FOR', false,
['WITH', 'LOCK', ';'],
BegPos, EndPos, TermKeyWord, false, false );
end;
Marcel Brink
Xploration.