NAME
DBIx::DBO::Row - An OO interface to SQL queries and results. Encapsulates a fetched row of data in an object.
SYNOPSIS
# Create a Row object for the `users` table
my $row = $dbo->row('users');
# Load my record
$row->load(login => 'vlyon') or die "Where am I?";
# Double my salary :)
$row->update(salary => {FUNC => '? * 2', COL => 'salary'});
# Print my email address
print $row ** 'email'; # Short for: $row->value('email')
# Delete my boss
$row->load(id => $row ** boss_id)->delete or die "Can't kill the boss";
METHODS
dbh
The read-write DBI
handle.
rdbh
The read-only DBI
handle, or if there is no read-only connection, the read-write DBI
handle.
do
$dbo->do($statement) or die $dbo->dbh->errstr;
$dbo->do($statement, \%attr) or die $dbo->dbh->errstr;
$dbo->do($statement, \%attr, @bind_values) or die ...
This provides access to the DBI->do method. It defaults to using the read-write DBI
handle.
tables
Return a list of DBIx::DBO::Table objects for this row.
value
$row->value($column)
Return the value in this field. $column
can be a column name or a Column
object.
load
$row->load(id => 123);
$row->load(name => 'Bob', status => 'Employed');
Fetch a new row using the where definition specified. Returns the Row
object if the row is found and loaded successfully. Returns an empty list if there is no row or an error occurs.
update
$row->update(id => 123);
$row->update(name => 'Bob', status => 'Employed');
Updates the current row with the new values specified. Returns the number of rows updated or '0E0'
for no rows to ensure the value is true, and returns false if there was an error.
Note: If LIMIT
is supported on UPDATE
s then only the first matching row will be updated otherwise ALL rows matching the current row will be updated.
delete
$row->delete;
Deletes the current row. Returns the number of rows deleted or '0E0'
for no rows to ensure the value is true, and returns false if there was an error.
Note: If LIMIT
is supported on DELETE
s then only the first matching row will be deleted otherwise ALL rows matching the current row will be deleted.
config
$row_setting = $dbo->config($option)
$dbo->config($option => $row_setting)
Get or set the DBIx::DBO::Row config settings. When setting an option, the previous value is returned.