[Dbix-class] last insert id problem with Oracle

Jess Robinson castaway at desert-island.demon.co.uk
Tue Jul 11 09:00:18 CEST 2006




On Mon, 10 Jul 2006, 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');

You have your id field as "id" there, yet your update_or_create has it as 
"ID". We're storing things in hashrefs, where things are case-senstive, 
and PK::Auto doesnt compare things lower-casedly.. So maybe thats your 
problem?

Jess

>
> 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");
>>> 		}
>>> 	    }
>>
>>
>
> _______________________________________________
> 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/dbix-class@lists.rawmode.org/
>
>



More information about the Dbix-class mailing list