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


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


  use DBIx::SearchBuilder;



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


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.


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.


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


Returns the first item


Returns the last item


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


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


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


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


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.

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

OPERATOR is the SQL operator to use for this phrase. =, !=, LIKE. NOT LIKE In the case of LIKE, the string ins surrounded in % signs. Yes. this is a bug.

STARTSWITH is like LIKE, except it only appends a % at the end of the string

ENDSWITH is like LIKE, except it prepends a % to the beginning of the string

on some databases, such as postgres, setting CASESENSITIVE to 1 will make this search case sensitive


Returns the current object's proposed WHERE clause.



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



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


returns the ORDER BY clause for the search.


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 instructs DBIx::SearchBuilder to join two tables.

The standard form 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. For this type of join, this method has no return value.

Supplying the parameter TYPE => 'left' causes Join to preform a left join. in this case, it takes ALIAS1, FIELD1, TABLE2 and FIELD2. Because of the way that left joins work, this method needs a TABLE for the second field rather than merely an alias. For this type of join, it will return the alias generated by the join.


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.


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.


Returns the current position in the record set.


Returns the number of records in the set.


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


Copyright (c) 2001 Jesse Vincent, jesse@fsck.com.

All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


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

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