Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value

[prev] [thread] [next] [Date index for 2005/11/21]

From: Peter Speltz
Subject: Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
Date: 13:53 on 21 Nov 2005
I thought you had to define a sequence in you CDBI code  for PG cause
it does not have auto inc columns. Is that right?

sequence / auto_incre=AD
       ment

         __PACKAGE__->sequence($sequence_name);

         $sequence_name =3D Class->sequence;
         $sequence_name =3D $obj->sequence;

       If you are using a
       database which supports
       sequences and you want
       to use a sequence to
       automatically supply
       values for the primary
       key of a table, then you
       should declare this
       using the sequence()
       method:


On 11/21/05, David Steinbrunner <carbon@xxxxx.xxx> wrote:
> Hello,
>
> For the past several months I have been working on a system that uses MyS=
QL
> and Class::DBI.  This has been my first project using Class::DBI while I
> have been hand coding queries for MySQL for several years.  I have just
> recently decided to make it so that the system works on top of Postgres,
> also.
>
> In the process of the getting Postgres working I ran into "Can't get last
> insert id".  I immediately did a Google search for last_insert_id and
> Class::DBI since I have used last_insert_id in a past database agnostic
> system.  I came upon the following:
>
> Class::DBI _auto_increment_value update/suggestion
> http://www.spanner.org/lists/cdbi/2005/06/22/03e95d38.html
>
> The discussion in the thread looks good but looking at the
> _auto_increment_value method has the following comment:
>
> # the DBI will provide a standard attribute soon, meanwhile...
>
> To get this up and running I went ahead and locally modified
> _auto_increment_value to use last_insert_id and I no longer have any issu=
es.
>
> So now I have several questions.
>
> What is the progress on getting _auto_increment_value it use last_insert_=
id
> and released on CPAN?  Is there anything I can do to help make this happe=
n
> such as code, testing or the like?
>
> Should I submit a RT bug concerning this issue?
>
> >From my understanding Postgres is a popular enough databases that it wou=
ld
> seem that this type of issue would have been handled by now.  What are ot=
her
> Postgres users doing regarding this issue?
>
> My database schema relies heavily on auto incrementing primary keys which=
 I
> never saw as a problem till I recently read the following from the Handel
> perldoc:
>
> http://search.cpan.org/~claco/Handel-0.27/lib/Handel.pm
>
> "Thanks to Class::DBI and staying away from auto incrementing ids, Handel
> should run in any database that Class::DBI supports."
>
> Aside from Class::DBI not using last_insert_id currently and some DBDs no=
t
> supporting last_insert_id, are there other concerns that I should be awar=
e
> of related to auto incrementing primary keys?
>
> Thanks,
>
> --
> David Steinbrunner
>
>
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>


--
pjs

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
Peter Speltz 13:53 on 21 Nov 2005

Generated at 19:11 on 22 Dec 2005 by mariachi v0.52