The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBR::Interface::Object An object representing a table about to be queried. This object is the entry point for executing queries against a given table

SYNOPSIS

 $dbrh->tableA->all();
 $dbrh->tableA->get( $primary_key );
 $dbrh->tableA->where( field => 'value' );
 $dbrh->tableA->where( 'relationshipB.field' => 'value' );

Methods

new

Constructor for DBR::Interface::Object - Called by DBR::Handle->tablename (autoloaded)

where

Initiates a database query based on provided constraints.

Arguments: Key value pairs of relationships/fields and values.

Returns: DBR::Query::ResultSet object containing resultant query

 # Simple use case:
 $dbrh->tableA->where( fieldname => $somevalue );

 # Constrain by related data:
 $dbrh->tableA->where( 'relationshipB.fieldX' => $somevalue );

 # Constrain by more related data:
 $dbrh->tableA->where(
                      'relB.fieldX' => 'value',
                      'relB.fieldY' => $somevalue, # same relationship twice, different fields - do the right thing
                      'relC.relD.relE.fieldZ' => $far_removed_value, # ...ad infinitum
                     );

By default, equality comparisons are assumed. ( field = 'value') For other types of comparisons:

 use DBR::Util::Operator; # Imports operators into your scope
 $dbrh->tableA->where( fieldname => NOT 'value' );
 $dbrh->tableA->where( fieldname => GT 123 );
 $dbrh->tableA->where( fieldname => LT 123 );
 $dbrh->tableA->where( fieldname => LIKE 'value%' );
 # And so on

For more details, See: DBR::Util::Operator

get

Initiates a database queryFetch all rows from a given table.

Arguments: single scalar value, or one arrayref of primary key ids.

 my $single_record = $dbrh->tablename->get( 123 ); # pkey 123
 my $resultset_obj = $dbrh->tablename->get( [ 123, 456 ] );

If given arrayref, Returns a single DBR::Query::ResultSet object containing resultant query

If given single value, Returns a single DBR::Query::Record object (dynamically created)

all

Initiates a database query with NO constraints. Fetch all rows from a given table.

Arguments: None

Returns: DBR::Query::ResultSet object containing resultant query

insert

enum

parse