Re: Interesting issue with create()

[prev] [thread] [next] [Date index for 2004/10/30]

From: Drew Taylor
Subject: Re: Interesting issue with create()
Date: 17:14 on 30 Oct 2004
On Sat, 30 Oct 2004 12:24:55 +0200, Jess Robinson
<castaway@xxxxxxxxxxxxx.x.xxxx.xx> wrote:

> Hi,
> I'm currently having problems with this. DB2's identity (generated by
> default as identity) fields seem to insist that in order to autogenerate a
> value, one just doesnt include this field at all, when using insert.
> But I don't see how to send that DEFAULT with CDBI either..

How about using a before_create trigger to set the value of the
primary column to 'DEFAULT'?

MyClass->add_trigger('before_create' => \&before_create);

sub before_create {
  my $self = shift;
  my $primary = $self->primary_column;
  $self->_attribute_set($primary, 'DEFAULT');
}

        -- 
        ----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------

(message missing)

Interesting issue with create()
Drew Taylor 17:50 on 24 Oct 2004

Re: Interesting issue with create()
Perrin Harkins 19:24 on 24 Oct 2004

Re: Interesting issue with create()
Jess Robinson 10:24 on 30 Oct 2004

Re: Interesting issue with create()
Drew Taylor 17:14 on 30 Oct 2004

Re: Interesting issue with create()
Jess Robinson 06:37 on 31 Oct 2004

Re: Interesting issue with create()
Drew Taylor 18:07 on 31 Oct 2004

Re: Interesting issue with create()
Lance A. Brown 18:21 on 31 Oct 2004

Re: Interesting issue with create()
Jess Robinson 06:31 on 02 Nov 2004

Re: Interesting issue with create()
Jess Robinson 06:28 on 02 Nov 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52