Article View: borland.public.interbase.linux
Article #45serializing docref
From: Frank Wang
Date: Sun, 10 Dec 2000 12:31
Date: Sun, 10 Dec 2000 12:31
38 lines
2001 bytes
2001 bytes
Hi List,
I have a table with following structure:
CREATE TABLE InvMst(
InvNo integer NOT NULL,
DocRef integer NOT NULL,
CONSTRAINT InvMst_PK PRIMARY KEY (InvNo),
) ;
CREATE UNIQUE INDEX InvMst_DocRef ON InvMst(DocRef);
Following are steps taken to insert a new record:
#1 Start a read commited transaction(read commited, rec_version, nowait)
#2 use a generator to assign a unique value to invno as primary key
#3 use 'select docref from invmst order by docref desc' and get the first
record, plus 1 to get
the next unused doc number and insert into the table(this is only
temporary)
#4 adding some records to the detail table(not listed here)
#5 repeat #3 to fetch a new doc number(just in case a record has been added
by other user), then commit.
my problem is, when multi users are connected, at step #3 I got an
exception:
"lock conflict on no wait transaction, attempt to store duplicate
values(visible to active transactions)
in unique index"
my understanding is, if not commited nothing can be seen by other
transactions, looks like not the case.
what should I do to be able to serialize(not using generator) docref in a
multi user version? thanks.
Frank
Technical Details
Message-ID:
<3a337603_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!203.170.3.87Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109030,9b7f43ac747dc42b,start X-Google-Attributes: gid109030,public X-Google-ArrivalTime: 2000-12-10 04:25:45 PST From: "Frank Wang" <wang@cebu.weblinq.com> Newsgroups: borland.public.interbase.linux Subject: serializing docref Date: Sun, 10 Dec 2000 20:31:51 +0800 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 203.170.3.87 Message-ID: <3a337603_2@dnews> X-Trace: 10 Dec 2000 04:24:35 -0800, 203.170.3.87 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!203.170.3.87