NAME

DBIx::SearchBuilder - Perl extension for easy SQL SELECT Statement generation

SYNOPSIS

use DBIx::SearchBuilder;

 ...

DESCRIPTION

CleanSlate

This completely erases all the data in the SearchBuilder object. It's useful if a subclass is doing funky stuff to keep track of a search

Next

Returns the next row from the set as an object of the type defined by sub NewItem. When the complete set has been iterated through, returns undef and resets the search such that the following call to Next will start over with the first item retrieved from the database.

GotoFirstItem

Starts the recordset counter over from the first item. the next time you call Next, you'll get the first item returned by the database, as if you'd just started iterating through the result set.

GotoItem

Takes an integer, n. Sets the record counter to n. the next time you call Next, you'll get the nth item.

First

Returns the first item

ItemsArrayRef

Return a refernece to an array containing all objects found by this search.

NewItem

NewItem must be subclassed. It is used by DBIx::SearchBuilder to create record 
objects for each row returned from the database.

RedoSearch

Takes no arguments. Tells DBIx::SearchBuilder that the next time it's asked for a record, it should requery the database

UnLimit

UnLimit clears all restrictions and causes this object to return all rows in the primary table.

Limit

Limit takes a paramhash.

# TABLE can be set to something different than this table if a join is # wanted (that means we can't do recursive joins as for now). Unless

# ALIAS is set, the join criterias will be taken from EXT_LINKFIELD # and INT_LINKFIELD and added to the criterias. If ALIAS is set, new # criterias about the foreign table will be added.

# VALUE should always be set and will always be quoted.

# IMO (TobiX) we # shouldn't use quoted values, we should rather use placeholders and # pass the arguments when executing the statement. This will also # allow us to alter limits and reexecute the search with a low cost by # keeping the statement handler.

# ENTRYAGGREGATOR can be AND or OR (or anything else valid to aggregate two clauses in SQL

# OPERATOR is whatever should be putted in between the FIELD and the # VALUE.

ShowRestrictions

Returns the current object's proposed WHERE clause.

Deprecated.

ImportRestrictions

Replaces the current object's WHERE clause with the string passed as its argument.

Deprecated

Orderby PARAMHASH

Orders the returned results by ALIAS.FIELD ORDER. (by default 'main.id ASC')

Takes a paramhash of ALIAS, FIELD and ORDER. ALIAS defaults to main FIELD defaults to the primary key of the main table. ORDER defaults to ASC(ending). DESC(ending) is also a valid value for OrderBy

_OrderClause

returns the ORDER BY clause for the search.

NewAlias

Takes the name of a table. Returns the string of a new Alias for that table, which can be used to Join tables or to Limit what gets found by a search.

Join

Join instructs DBIx::SearchBuilder to join two tables. It takes a param hash with keys ALIAS1, FIELD1, ALIAS2 and FIELD2.

ALIAS1 and ALIAS2 are column aliases obtained from $self->NewAlias or a $self->Limit FIELD1 and FIELD2 are the fields in ALIAS1 and ALIAS2 that should be linked, respectively.

RowsPerPage

Limits the number of rows returned by the database. Optionally, takes an integer which restricts the # of rows returned in a result Returns the number of rows the database should display.

FirstRow

Get or set the first row of the result set the database should return. Takes an optional single integer argrument. Returns the currently set integer first row that the database should return.

_ItemsCounter

Returns the current position in the record set.

Count

Returns the number of records in the set.

IsLast

Returns true if the current row is the last record in the set.

AUTHOR

Jesse Vincent, jesse@fsck.com

SEE ALSO

DBIx::SearchBuilder::Handle, DBIx::SearchBuilder::Record, perl(1).