[CDBI] Class::DBI classes with a default primary key

[prev] [thread] [next] [Date index for 2005/08/23]

From: marcus baker
Subject: [CDBI] Class::DBI classes with a default primary key
Date: 17:51 on 23 Aug 2005
i've inherited a table from someone else (that i'd rather not alter),
setup somewhat like this:

CREATE TABLE mytable (
    userid  INTEGER NOT NULL,
    building VARCHAR2 (100),
    room VARCHAR2 (100),
    browser VARCHAR2 (500),
    cdate TIMESTAMP(6) DEFAULT current_timestamp NOT NULL
)

note that nothing is auto incremented, and that no actual primary keys
have been set.

i'd like to integrate the table into Class::DBI, defining the two
columns of 'userid' and 'cdate' as primary keys.  create() fails under
that setup, as Class::DBI wants both primary keys defined in the
hashref passed in.  is there a way to let Class::DBI proceed creating
without having specified the cdate column, since it's generated by the
system?

i understand that i could programmatically set the cdate column in the
hashref passed to the create() method, just alter the table to have
'real' primary keys, or just set any other column as a primary key and
run the search() method instead of retrieve() when it's needd, but i
would like to know this kind of information for future reference.

thanks
-marcus

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

[CDBI] Class::DBI classes with a default primary key
marcus baker 17:51 on 23 Aug 2005

Generated at 16:14 on 20 Sep 2005 by mariachi v0.52