Article View: borland.public.cppbuilder.database.ado
Article #5209Re: Clarification on AutoInc fields
From: Yakunin V.V.
Date: Wed, 04 Jul 2001 09:34
Date: Wed, 04 Jul 2001 09:34
48 lines
2891 bytes
2891 bytes
Hi !!! I think that it is one of the right way to solve AutoInc fields problem. But this statement: SELECT gen_id(generator_name,1), COUNT(*) FROM table_name will decrease perfomance of the application if table you are selecting from has lots of records. So I'd like to suggest the following solution: 1. In database should be created special table with only record. 2. Select statement should be changed as follows: SELECT gen_id(<generator_name>, 1) from <name_of _table_with_only_record> Best Regards !!! Umberto Uderzo <umberto@uderzo.it> wrote in message news:3b40f10e_2@dnews... > Hi Francesco, > > Thanks for descripting your approach to the problem. Personally i've adopted > another tehnique (sure it's not much portable, but it will be easily adapted > for other DBMS): instead of using a generator into a trigger to autoset the > primary key value (this causes problems trying to refresh the autoinc field) > i perform directly the query SELECT gen_id(generator_name,1), COUNT(*) FROM > table_name, where gen_id is a proprietary sintax of Interbase used to get an > unique id from a <generator_name> generator that doesn't suffer multiuser > troubles, and COUNT(*) is used as grouping function to avoid the result of > generating as many new id as the rows of the table <table_name>, used here > only to respect the select syntax. > I repeat, not so portable, but easily replaceable with your technique if > needed (just isolating the entire id generation process into a private > session). > > Ciao... Umberto Uderzo > > P.S. I think it's a bit dangerous to rollback the id rows values as you say. > To have a sure robust mechanism i suggest to increment always and anyway. > So: perform the increment step in a separate session. > > "Formentz" <francesco@leotron.com> ha scritto nel messaggio > news:3b3c7c38_1@dnews...
Technical Details
Message-ID:
<3b42e1b1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b3b532b$1_2@dnews> <3B3BD2D2.5F446F35@temporaldoorway.com> <3b3c3ad2_1@dnews> <3b3c7c38_1@dnews> <3b40f10e_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,2eab2f6830ef7732 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-07-04 02:28:59 PST Reply-To: "Yakunin V.V." <vvy@jensen.ru> From: "Yakunin V.V." <vvy@jensen.ru> Newsgroups: borland.public.cppbuilder.database.ado References: <3b3b532b$1_2@dnews> <3B3BD2D2.5F446F35@temporaldoorway.com> <3b3c3ad2_1@dnews> <3b3c7c38_1@dnews> <3b40f10e_2@dnews> Subject: Re: Clarification on AutoInc fields Date: Wed, 4 Jul 2001 13:34:57 +0400 Lines: 51 Organization: Jensen Technologies LLC X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 212.113.107.55 Message-ID: <3b42e1b1_2@dnews> X-Trace: dnews 994238897 212.113.107.55 (4 Jul 2001 02:28:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews