[rt-users] Re: [Bps-internal] some observation about JavaScript & buttonToLink();
Jesse Vincent
jesse at bestpractical.com
Sat Oct 14 15:14:42 EDT 2006
On Sat, Oct 14, 2006 at 07:53:44AM -0400, Vivek Khera wrote:
>
> On Oct 13, 2006, at 6:48 PM, Joby Walker wrote:
>
> >OIDs were used to get the id of the last insert. The was abandoned
> >because of pgsql 8.1, but it was a horrible way to get the last id
> >anyway. Current versions of SB insert the row and then get the
> >current value of the sequence associated with that table. This is
> >much faster and *should* be safe.
>
> Does it actually query the sequence or does it just pull the last
> insert id from the connection's return status? if the former, then
> it is not multi-thread safe, if the latter then it is faster than
> your method of pulling a sequence then doing insert (one trip to DB
> vs. two).
my $sequence_name = $self->IdSequenceName($table);
unless ($sequence_name) { return ($sequence_name) } # Class::ReturnValue
my $seqsth = $self->dbh->prepare( qq{SELECT CURRVAL('} . $sequence_name . qq{')} );
$seqsth->execute;
$self->{'id'} = $seqsth->fetchrow_array();
A dozen people assured me that this was considered the postgres-blessed way to do this these days. Is it not?
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
--
More information about the rt-users
mailing list