Locking problem with Informix 7.22C1, Online
Posted in 1999
Topics: General Discussion
We made a Delphi Program with an Informix database. When I want to change one particular record, The Borland BDE constantly gives the error 'couldn't perform the edit because another user changed the record'. We brought the database down, but the problem persists with that record. We even pumped the table to anther machine (from Informix on Sun to informix on Linux), and then again we can't change that records. There is no problem with all other records. How is the locking mechanism working (We use page locking)? What is the meaning of the table syslocks in the database sysmaster? Are records in the table syslocks removed when the database goes down?
It seems to be a Borland BDE error.
When I want to change one particular record with a Delphi program (or with
the SQL Explorer), The Borland BDE constantly gives the error 'couldn't
perform the edit because another user changed the record'.
I use Delphi4 with the BDE 5.1. I also tested with BDE 5.01.
When I try to change the record with an SQL statement with dbaccess of with
the SQL Explorer (update tregdet set kostenplts='6F' where regnr=72 and
kostenplts='7F' ) then I can change the record, so the record isn't locked!
I put the table with Datapump to another machine (from Informix 7.22C1,
Online on Sun Solaris to Informix 7.3 on Linux Suse), that particular record
still can't be changed. I'm sure the record isn't locked (I am the only
person on this machine).
I changed the lock level of this table from page locking to row locking, but
that isn't a solution.
The structure of the table is:
-- Table infebema.tregdet
CREATE TABLE infebema.tregdet (
regnr INTEGER,
eindtijd DATETIME YEAR TO FRACTION(3),
pctijd DATETIME YEAR TO FRACTION(3),
werkduur FLOAT,
kostenplts CHAR(3),
prestacode CHAR(3),
pcnaam CHAR(10),
controle CHAR(1),
prwerkduur FLOAT,
prkostenplts CHAR(3),
prprestacode CHAR(3),
gewijzigddoor CHAR(10)
) EXTENT SIZE 16 NEXT SIZE 16 LOCK MODE ROW
-- Index infebema.regnrtijd
CREATE INDEX infebema.regnrtijd ON infebema.tregdet (
regnr ASC,
eindtijd ASC)
Who can help me?
Powerbuilder often has a similar problem. When Powerbuilder experiences it it's because the default update syntax it generates uses a WHERE clause that includes every field that was displayed to the screen as opposed to just the primary or unique key of the table. If one or more of those field is NULL or is a zero-length string (ie "") powerbuilder messes up. Food for thought
I finally solved the problem. The problem is the updatemode property of my TQuery in Delphi. When updatemode=UpdateWhereAll, then the BDE tries to find the record by sending a SLQ statement with the value of every field (you can see this with the borland sql monitor). But the BDE has sometimes problems with float fields: it sometimes puts more or less digits after the decimal point than the original value. So the value in the sql statement doesn't match with the value in Informix. And then Informix says the record has changed! When I put the updatemode of my TQuery on 'UpdateKeyOnly', my problem is solved. Then the BDE only puts the values of the index fields in the SQL statement to find the record. Thanks anyway for your replies. Philippe