[CDBI] Dealing with non-required primary keys
peterspeltz at gmail.com
Sun Sep 4 12:44:01 BST 2005
On 9/4/05, Rusty Phillips <rustyp at freeshell.org> wrote:
> > It seems your solution would be to patch the specific drivers for each
> > RDBMS you want to use so they work.
> I guess that's one way. There's a lot of brokenness in them, though.
> It also means only using the databases that have Class::DBI drivers and
> hoping that they continue to work forever.
> A database-agnostic way would be to have a way to specify that
> Class::DBI doesn't have to worry about certain primary keys because the
> database will take care of it.
> In which case, may I suggest a change to Class::DBI to
> make it possible? How about allowing this behaviour (ignoring the
> primary keys during insert) when the "use sequence" command has no
> arguments? I'd be happy to implement it and send in a patch.
I really don't know that much about the internals of CDBI or its
subclasses. However I thought this was exactly what CDBI does. If you
want CDBI to worry about making the PK, then you set a sequence.
($class->sequence($name) ). If your RDBMS does not need you to create
values for the PK, like Mysql, you don't set a sequence and
Class::DBI won't make a value for that column and instead lets the DB
do it. Is this not what happens?
Are you trying to make one CDBI class that works for all RDBMS's auto
inc or sequence mechanisms?
More information about the ClassDBI