Persistent::MySQL is a persistent class implemented using a MySQL database.
SYNOPSIS
use Persistent::MySQL;
use English; # import readable variable names like $EVAL_ERROR
eval { ### in case an exception is thrown ###
### allocate a persistent object ###
my $emp = new Persistent::MySQL($data_source, $username, $password, $table);
### define attributes of the object ###
$emp->add_attribute('empno', 'ID', 'Number', undef, 4);
$emp->add_attribute('ename', 'Persistent', 'VarChar', undef, 10);
$emp->add_attribute('job', 'Persistent', 'VarChar', undef, 9);
$emp->add_attribute('mgr', 'Persistent', 'Number', undef, 4);
$emp->add_attribute('hiredate', 'Persistent', 'DateTime', undef);
$emp->add_attribute('sal', 'Persistent', 'Number', undef, 7, 2);
$emp->add_attribute('comm', 'Persistent', 'Number', undef, 7, 2);
$emp->add_attribute('deptno', 'Persistent', 'Number', undef, 2);
### query the datastore for some objects ###
$emp->restore_where(qq{
sal > 1000 and
job = 'CLERK' and
ename LIKE 'M%'
}, "sal, ename");
while ($emp->restore_next()) {
printf "ename = %s, emp# = %s, sal = %s, hiredate = %sn",
$emp->ename, $emp->empno, $emp->sal, $emp->hiredate;
}
};
if ($EVAL_ERROR) { ### catch those exceptions! ###
print "An error occurred: $EVAL_ERRORn";
}
ABSTRACT
This is a Persistent class that uses a MySQL database table to store and retrieve objects. This class can be instantiated directly or subclassed. The methods described below are unique to this class, and all other methods that are provided by this class are documented in the Persistent documentation. The Persistent documentation has a very thorough introduction to using the Persistent framework of classes.
Product's homepage
Requirements:
· Perl