Oracle, Postgeres and possible other databases use sequences for
sequential number generation for pk type scenarios.  Postgresql has
added the serial/bigserial datatypes which use triggers for
autoincrementing the serial columns.  But this still requires a select
statement to acquire the inserted value.

In the past you had/have to select nextval('my_sequence') prior to
inserting. The populate the pk field with the value and perform the
insert, or write your own triggers.

We can select curval('my_sequence') form the database to determine the
value last retrieved from the most recent trigger auto-population of
serial datatype, however, this requires a sequence name be known.
Although this can be determined progmatically, I'd like to be able to
manually set the sequence name property for the pk field and have select
nextval('my_sequence') sql executed to populate the pk filed, prior to
the insert.

The argument might be that this can be handled by hand in the newrecord
method.  This however, is often used for both databases, so I think it
would be prudent to add a 'sequence' type property to the bizobject and
incorporate population of the pk filed via the sequence.

The bizObject would then store the last inserted pk value for later
reference by child records.

-Joseph

On Tue, 2007-04-17 at 13:05 -0700, johnf wrote:
> > > Not sure where you are going with the question?
> >
> >     We only have to handle the common case. If someone is going to
> > create a database with all sorts of custom stuff, they will have to
> > handle that themselves. Surely you don't think that Dabo should be
> > able to anticipate every strange design that someone might come up with?
> >
> >     If the database provides a way of producing auto-increment keys, it
> > will have a standard way of returning them. That's the only thing we
> > need to handle. You're going off on tangents trying to imagine every
> > possible permutation, and that's just not what this method is for.
> >
> > -- Ed Leafe
> > -- http://leafe.com
> > -- http://dabodev.com
> 
> OK then I just use the curval or lastval.
> 
> Just to be sure - I can assume that the insert has occurred and was 
> successful?



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to