NAME

DB2::Row Framework wrapper around rows using DBD::DB2

SYNOPSIS

package myRow;
use DB2::Row;
our @ISA = qw( DB2::Row );

...

use myDB;
use myTable;

my $db = myDB->new;
my $tbl = $db->get_table('myTable');
my $row = $tbl->find($id);
print $row->col_name;

FUNCTIONS

new

Do not call this - you should get your row through your table object. To create a new row, see DB2::Table::create_row

save

Save the current row. Will happen automatically if it can.

discard_changes

If you do not want your changes up to this point to be kept, discard_changes will do the obvious

timestamp_to_time

Converts a DB2 timestamp column to a perl ("C") time value

time_to_timestamp

Converts a perl ("C") time value to a DB2 timestamp string.

validate_column

Override this if you need to validate changes to a column. Normally you can leave this to the database itself, but you may want to do this earlier than that. You can also use this to massage the value before it is kept.

The parameters are:

self
column name
new value

To keep the value as given, simply return it. To modify (massage) the value, return the modified value. To prevent the update, die.

Remember to call your SUPER before validating yourself to allow for future enhancements in DB2::Row. The base function may perform massaging such as converting time to timestamp, etc., in the future, so you can get that for free then. Currently this behaviour is done in the column method, but it may move into here in the future.

Beware not to try to update the current column directly or indirectly through this method as you could easily end up with infinite recursion.

column

This get/set method allows you to retrieve or update any given column for this row. With a single parameter, it will return the current value of that column. The second parameter will be the new value to use. This value will be validated before being used.

find

Shortcut to calling DB2::Table::find_id.

find_where

Shortcut to calling DB2::Table::find_where

table_name

Shortcut to calling DB2::Table::full_table_name

count

Shortcut to calling DB2::Table::count

count_where

Shortcut to calling DB2::Table::count_where

table_name

Shortcut to calling DB2::Table::SELECT

AUTOLOADed functions

Any column defined by the corresponding DB2::Table object is also a get/set accessor method for DB2::Row. For example, if you have a column named "LASTNAME" in your table, $row_obj->lastname() will retrieve that column from the $row_obj object, while $row_obj->lastname('Smith') will set that objects' lastname to 'Smith'.