Subject | RE: [IBO] Newbie transaction questions |
---|---|
Author | Alan McDonald |
Post date | 2002-12-10T09:07Z |
Joe,
you can set the generator to whatever value you want - obviously the next
number up after max is where you want it.
You'd best be advised not to use primary key values as your "sale numbers"
there are other methods to secure continous numbering in this reagrd. the OK
is for database use only.
Alan
-----Original Message-----
From: Joe Martinez [mailto:joe@...]
Sent: Tuesday, 10 December 2002 7:57 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Newbie transaction questions
implemented them so far, since it seems like a lot of work to make the
conversion. I try not to do metadata changes more than once per year. I
didn't set it up that way originally because my app originally used
Paradox, not IB, and most of the code was reused.
For now, what I've been doing has worked very well. As long as I commit
the master record, I know whether I got a unique key or not. If I get a
Key Violation, I bump it up one more and try again until I succeed. (A key
violation actually rarely happens, since there are generally only 2-3 users
at a time, and the chances of them grabbing a key at the same instant is
slim.) Once it succeeds, I know what the correct master key is, and can
insert my detail records safely. I'll continue this way for now. Your
other answers gave me the answers I needed to proceed in moving to TIB_DSQL
objects and explicit transactions.
Maybe next year I'll look into implementing generators. If I do that, will
all my original keys still be valid, or do I have to re-pump the
data? When I create the generator, will it automatically know where the
keys left off last time?
Actually, one other reason I can think of to avoid generators is possible
gaps in numbering sequences. Let's say I insert a record, but then end up
rolling it back. Isn't it's key number gone forever? You said that once
it's generated, it will never be re-used. That would leave a gap in the
numbering sequence. My customers don't like to see that. They want the
sale numbers to be continuous without gaps. Otherwise it looks like
someone may have been tampering with the data.
-Joe
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
you can set the generator to whatever value you want - obviously the next
number up after max is where you want it.
You'd best be advised not to use primary key values as your "sale numbers"
there are other methods to secure continous numbering in this reagrd. the OK
is for database use only.
Alan
-----Original Message-----
From: Joe Martinez [mailto:joe@...]
Sent: Tuesday, 10 December 2002 7:57 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Newbie transaction questions
>I guess by now you realise that that isn't going to protect your dataThanks for all the info. I've known about generators, but haven't
>integrity at all well and could leave you with either unwanted master
>records or orphan detail records.
>
>Please get rid of your transaction-dependent manufactured keys and use
>Fb/IB as it was designed to be used.
implemented them so far, since it seems like a lot of work to make the
conversion. I try not to do metadata changes more than once per year. I
didn't set it up that way originally because my app originally used
Paradox, not IB, and most of the code was reused.
For now, what I've been doing has worked very well. As long as I commit
the master record, I know whether I got a unique key or not. If I get a
Key Violation, I bump it up one more and try again until I succeed. (A key
violation actually rarely happens, since there are generally only 2-3 users
at a time, and the chances of them grabbing a key at the same instant is
slim.) Once it succeeds, I know what the correct master key is, and can
insert my detail records safely. I'll continue this way for now. Your
other answers gave me the answers I needed to proceed in moving to TIB_DSQL
objects and explicit transactions.
Maybe next year I'll look into implementing generators. If I do that, will
all my original keys still be valid, or do I have to re-pump the
data? When I create the generator, will it automatically know where the
keys left off last time?
Actually, one other reason I can think of to avoid generators is possible
gaps in numbering sequences. Let's say I insert a record, but then end up
rolling it back. Isn't it's key number gone forever? You said that once
it's generated, it will never be re-used. That would leave a gap in the
numbering sequence. My customers don't like to see that. They want the
sale numbers to be continuous without gaps. Otherwise it looks like
someone may have been tampering with the data.
-Joe
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/