[CDBI] Committing on delete

Nick Peters np1 at sanger.ac.uk
Thu Apr 27 14:07:39 BST 2006


Michael Peters wrote:
> Nick Peters wrote:
>   
>> Hi,  I'm sorry about having to ask such a basic question.
>>
>> I'm trying to add transactions to my database.  I have been able to
>> commit insertions and edit records but I really can't work out how to
>> commit deletions.
>>
>> Trying update or dbi_commit  on the object I have just deleted gives me
>> the error "Can't locate object method "x" via package
>> "Class::DBI::Object::Has::Been::Deleted" which I can understand as I'm
>> trying to call it on an object I have just deleted but I can't work out
>> how I am meant to commit the change.
>>     
>
> dbi_commit() is actually a class method, not an object method. It works
> when you call it on an object, but that's just a side-effect. In fact,
> it's confusing to call it as an object method since it doesn't just
> commit that object, but everything since your last commit.
>
> I would recommend that you always call it like so:
>   MyApp::DB->dbi_commit();
>
>   


Thankyou Michael and Matt,

That works now. It was totally a misunderstanding on my part as to what  
dbi_commit() was actually doing.

Nick




More information about the ClassDBI mailing list