[Dbix-class] last insert id problem with Oracle

Anthony Lincoln ahlincoln at lbl.gov
Mon Jul 10 20:27:35 CEST 2006


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');


Matt S Trout wrote:
> Anthony Lincoln wrote:
> 
>>Matt S Trout wrote:
>>
>>>Anthony Lincoln wrote:
>>>
>>>
>>>>Nope, no luck.  Autoincrement works fine with/without quoted $id, but I 
>>>>still get left with no $change->id.  I just upgraded to DBI 1.51, so I'm 
>>>>pretty sure it's not a version issue.
>>>
>>>Are you going to show us the rest of the code at some point? I mean, I could 
>>>use my psionic powers to magically figure out what's in your DBIC classes but 
>>>that's a commercial service only :)
>>>
>>
>>Fair enough.  Here's the offending snippet, and let me know if you need 
>>more.  Like I said, the insert and autoincrement works fine; it's just 
>>the id that isn't there.  But I can view a list of items afterward, 
>>select the change I just made, and edit it no problem.
> 
> 
> Y'know the best where I said "your DBIC classes" ?
> 
> That's because I want to see what's in the DBIC classes. Specifically the 
> class of which $change is a member.
> 
> The CREATE table for the table would also help.
> 
> 
>>             my $change = $model->update_or_create({
>>                 ID => $id,
>>                 owner => $user_id,
>>                 name => $hash{name},
>>                 prereq_id => $hash{prereq_id},
>>                 dependent => $hash{dependent},
>>                 description => $hash{description},
>>                 backout_plan => $hash{backout_plan},
>>                 visibility => $hash{visibility},
>>                 risk => $hash{risk},
>>                 sys_criticality => $hash{sys_criticality},
>>                 sys_affected => $hash{sys_affected},
>>                 qa_difficulty => $hash{qa_difficulty},
>>                 install_difficulty => $hash{install_difficulty},
>>                 problem_visibility => $hash{problem_visibility},
>>                 completed => $hash{completed},
>>                 creator => $creator,
>>             },{ key => 'primary' }
>>             );
>>
>>             if ($change) {
>>                 if (!$change->id) {
>>                     $c->log->debug("no change id");
>>		}
>>	    }
> 
> 



More information about the Dbix-class mailing list