[CDBI] transactions with class dbi

jvanhan jvanhan at gmail.com
Fri Mar 17 13:32:09 GMT 2006


Hello All,

I am new to CDBI and am having troubles with transactions. There must be
something simple that I am overlooking because the samples do not seem to
work.

I am using MySQL 4.1.11 as my database.

My Global Class DBI looks like:

package myDB::DBI;
use base 'Class::DBI';
use myDB::connParam;

my $cp = myDB::connParam->new;

__PACKAGE__->connection('dbi:mysql:mydb',$cp->user,$cp->pass,{AutoCommit =>
0});

1;

in my testing code which goes through cgi I have

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use CGI;
use strict;
use myDB::study;

my $cgi = new CGI;
print $cgi->header();

my $study = myDB::study->create({
    name=> "name",
    detail => "datail",
    description => "is there life on mars?"}
);

$study->dbi_rollback;

This rollback does not happen although the autocommit property is set to 0.
So the data end up in the database anyway.

Any help would be much appreciated.

Thanks a bunch,
Jack.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20060317/f81c7898/attachment.htm


More information about the ClassDBI mailing list