Big Sister Web Application Framework
List of all members
BigSWAF::DBCapsulator::SearchFilter Class Reference

Search Filter encapsulation. More...

Inheritance diagram for BigSWAF::DBCapsulator::SearchFilter:
BigSWAF::DBCapsulator

Public Class Methods

SearchFilter new ()
 Create a new SearchFilter.

Public Object Methods

scalar sqlexpr (scalar expr)
 Set or fetch the SQL expression that corresponds with this filter.
void addorder (scalar field, scalar descending)
 Add a field name to the list of fields the search result should be ordered by.
list orderfields (list fields)
 Get or set a list of fields the search results should be ordered by.
boolean isdescending (scalar field, scalar descending)
 Get or set if a field is to be sorted in descending order.
scalar sqlorder ()
 Get the ordering settings as a string ready for inclusion in an SQL SELECT statement.

Additional Inherited Members

- Public Member Functions inherited from BigSWAF::DBCapsulator
DBCapsulator database (scalar db)
 Opens a connection to the given database.
 connect (hashref dbcfg)
 Connect to a database using the given database connection.
hashref dbcfg (hashref dbcfg)
 Get/set the configuration of the current database connection.
int search (BigSWAF::DBCapsulator::SearchFilter filter)
 Search the database/relation for records matching the given filter.
hashref getnext ()
 Get the next result record of a previous search().
int add (hashref record)
 Add a record to the database/relation.
 delete (hashref record)
 Remove a record from the database/relation.
 update (hashref record)
 Update a record in the database/relation.
retval close ()
 Closes the database connection.
hash getnext_locallysorted (SearchFilter filter)
 Returns the next record from a search.
void clear_sortcache (scalar size)
 Clears and setup the cache used by getnext_locallysorted().
retval schema (scalar name)
retval config (scalar cfg)
 Read a config file defining the data connections.
retval schemadir (scalar dir)
 Set the directory where DBCapsulator will find meta information for the tables.
retval error (scalar msg)
 Prints an error message.

Detailed Description

Search Filter encapsulation.

Member Function Documentation

void BigSWAF::DBCapsulator::SearchFilter::addorder ( scalar  field,
scalar  descending 
)

Add a field name to the list of fields the search result should be ordered by.

Parameters
fieldThe name of the field that should be added.
descending(optional) must be "1" if order should be descending.
boolean BigSWAF::DBCapsulator::SearchFilter::isdescending ( scalar  field,
scalar  descending 
)

Get or set if a field is to be sorted in descending order.

Parameters
fieldThe name of the field.
descending(optional) If set, the descending status is set to this value
Returns
true if the field is to be ordered in descending order, false otherwise
SearchFilter BigSWAF::DBCapsulator::SearchFilter::new ( )

Create a new SearchFilter.

list BigSWAF::DBCapsulator::SearchFilter::orderfields ( list  fields)

Get or set a list of fields the search results should be ordered by.

Parameters
fields(optional) If set, the list of order field names is set to this list.
Returns
The list of field names.
scalar BigSWAF::DBCapsulator::SearchFilter::sqlexpr ( scalar  expr)

Set or fetch the SQL expression that corresponds with this filter.

This expression can be used as is in a SQL SELECT statement.

Parameters
exprString specifying the SQL expression. If this parameter is undefined the current expression is returned without any change.
Returns
The current search filter expression.
scalar BigSWAF::DBCapsulator::SearchFilter::sqlorder ( )

Get the ordering settings as a string ready for inclusion in an SQL SELECT statement.

Returns
String with an "ORDER BY" statement or an empty string if no order has been requested.

The documentation for this class was generated from the following file: