TOracleDataset descendant? Design advice needed!

nicofari

Member²
Hello all,

I would like to customize the sequence-field behaviour of the TOracleDataset class.

I would need to substitute the call "sequence.nextval" with a call to a pl/sql function.

I was thinking about writing a TOracleDataset descendant but it seems that TOracleDataset is not designed for overriding the SequenceField stuff..

Which is, in your opinion, the best design to adopt?

Thanks in advance
Bye
Nicola
 
Perhaps you can simply use TField.Default? You can enter any valid SQL or PL/SQL function here. The function is called as part of the insert statement when a new record is posted. The derived value is updated in the dataset after the insert.
 
The problem is that we already made some forms with several standard TOracleDataset which are using several sequences.

I would like to keep the property SequenceField but customize it with this pseudo-logic (in OnNewRecord):

if does exist a procedure X in the db
call procedure X(SequenceName, FieldName) to get the number

else
standard beaviour

In this way I would do a global substitution in the project (all TOracleDataset in e.g. TMyOracleDataset) so I don't need to customize each component one by one..

I will try looking at the OnNewRecord event..
but I would need a way to enable/disable the
sequence.nextval call in the standard TOracleDataset.

Mmmh , not very clear, I fear...

Thanks anyway

Nicola
 
Originally posted by nicofari:

...
I would need to substitute the call "sequence.nextval" with a call to a pl/sql function.
...
Which is, in your opinion, the best design to adopt?
...
Don't know your exact needs, but usually it is a very bad idea (I even dare to say, design bug) to substitute sequence.nextval reference with custom function call as it:
  • will very likely increase contention problems in multiuser environment a magnitude so really killing scalability [f times
  • almost never is really needed (99 times for 100 it is worthless and senseless try to avoid so-called "sequence-gaps"

Very good discussion of this topic you can find on asktom.oracle.com. Once more, as you have not explained your real need all said may be not relevant for your case, but ...

Oleksandr Alesinskyy
 
I am not trying to avoid "sequence-gaps".
What I need is a kind of "global" sequence so that the numbers she gave me are unique among different schemas.
The stored procedure simply call a sequence.nextval in a kind of "global" schema different from that in which the application resides.
This behaviour is not fixed, however. The global schema doesn't always exist (it is for internal use only)
When it isn't present the local sequence is ok.
So I am looking a way to customize the TOracleDataset
Anyway I will check asktom (i always do...)
Thanks
Nicola
 
Back
Top