Re: [CDBI] Dealing with non-required primary keys

[prev] [thread] [next] [Date index for 2005/09/04]

From: Rusty Phillips
Subject: Re: [CDBI] Dealing with non-required primary keys
Date: 11:24 on 04 Sep 2005
While it's impossible to have keys that have no values inside the RDBMS,
you can certainly have ones that don't have to be input with an insert
command.  There is such a thing in every RDBMS that I've tried.

On Sun, 2005-09-04 at 05:17 -0500, Peter Speltz wrote:
> I think your subject reveals your trouble: "non-required primary
> keys".  There is no such thing.  It seems what you are  worried about
> is locking into a single RDBMS by having to declare "sequence" or not
> and that the code written to not do this is not good enough.   
Looking at the individual subclasses of Class::DBI, it looks like the
subclasses themselves all declare sequences.  Is there code somewhere
that I'm not aware of to not require sequences at all?
> I
> believe Class::DBI::Loader will set up autoinc PKs correctly   based
> on the RDBMS specified in the dbi connection string but it is using
> the code in specific drivers.
Class::DBI::Loader is just automagic to get the proper superclasses to
work.  It doesn't do anything with autoincs.  The setting up of the
autoinc PKs is handled by subclasses of Class::DBI, such as
Class::DBI::Pg, Class::DBI::MySQL, etc.

> 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.  But if that's impossible right now, then
it's impossible.  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.


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


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

(message missing)

[CDBI] Dealing with non-required primary keys
Rusty Phillips 01:20 on 04 Sep 2005

RE: [CDBI] Dealing with non-required primary keys
Rusty Phillips 02:39 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Peter Speltz 10:17 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Rusty Phillips 11:24 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Peter Speltz 11:44 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Peter Speltz 11:46 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Rusty Phillips 12:04 on 04 Sep 2005

Re: [CDBI] Dealing with non-required primary keys
Matt S Trout 12:12 on 04 Sep 2005

Generated at 13:57 on 10 Sep 2005 by mariachi v0.52