Anthony Lincoln wrote:
> Matt S Trout wrote:
> 
>>Anthony Lincoln wrote:
>>
>>
>>>package ccm::Model::CCMData::Issweb::CcmChange;
>>>
>>>use strict;
>>>use warnings;
>>>use base 'DBIx::Class::Core';
>>>
>>>__PACKAGE__->load_components(qw/PK::Auto Core/);
>>>__PACKAGE__->table('ccm_change');
>>>__PACKAGE__->add_columns(qw/id owner name prereq_id dependent description
>>>                         backout_plan visibility risk sys_criticality
>>>                         sys_affected qa_difficulty install_difficulty
>>>                         problem_visibility completed creator created/);
>>>__PACKAGE__->set_primary_key('id');
>>>__PACKAGE__->sequence('ccm_seq');
>>
>>
>>Is your sequence "just a sequence" or do you have a trigger defined to 
>>populate ccm_change from it? PK::Auto expects the database to populate the 
>>key 
>>during INSERT; it doesn't read the sequence to populate it itself.
> 
> 
> There's a trigger defined to autoincrement ccm_change.id.  All that 
> seems to work fine.
> 
> CREATE TRIGGER ccm_user_trig
>          BEFORE INSERT ON ccm_user
>          FOR EACH ROW
>          BEGIN
>                  SELECT ccm_seq.nextval INTO :new.id from dual;
>          END;
> .
> RUN;

Sorry, doing three things at once.  Here's the appropriate trigger:

CREATE TRIGGER ccm_chg_trig
         BEFORE INSERT ON ccm_change
         FOR EACH ROW
         BEGIN
                 SELECT ccm_seq.nextval INTO :new.id from dual;
                 SELECT sysdate INTO :new.created from dual;
         END;
.
RUN;

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to