Class PEARDB_DataObjectDataListSource

Description

This class provides DB abstraction for phpHtmlLib datalists using DB_DataObjects as the interface

Located in /widgets/data_list/PEARDB_DataObjectDataListSource.inc (line 22)

DataListSource
   |
   --SQLDataListSource
      |
      --PEARDB_DataObjectDataListSource
Variable Summary
mixed $count
mixed $_dbdo
mixed $_vars
Method Summary
PEARDB_DataObjectDataListSource PEARDB_DataObjectDataListSource (DB_DataObject &$db)
void add_column (string $title, string $data_name, [boolean $sortable = FALSE], [boolean $searchable = FALSE], [string $sortorder = "ASC"])
void build_limit_clause ( $offset,  $limit)
void build_query ([boolean $limit_flag = TRUE])
int count ()
int do_query ()
DB_DataObject get_dbdo ()
void setup_db_options (array $opts)
Variables
mixed $count = 0 (line 28)
mixed $_dbdo (line 24)

The DB_DataObject used for this source

mixed $_vars (line 27)

List of variables to return in get_next_data_row()

Inherited Variables

Inherited from SQLDataListSource

SQLDataListSource::$_db_options
SQLDataListSource::$_default_order_sensitivity
SQLDataListSource::$_query
SQLDataListSource::$_simple_search_case_insensitive

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_debug
DataListSource::$_query_params
Methods
Constructor PEARDB_DataObjectDataListSource (line 36)

Constructor

PEARDB_DataObjectDataListSource PEARDB_DataObjectDataListSource (DB_DataObject &$db)
  • DB_DataObject &$db: source for the datalist
add_column (line 53)

Add a column of data to manage

void add_column (string $title, string $data_name, [boolean $sortable = FALSE], [boolean $searchable = FALSE], [string $sortorder = "ASC"])
  • string $title: title of this column
  • string $data_name: name of the associated column in the database table
  • boolean $sortable: is the column sortable? default: FALSE
  • boolean $searchable: is the column searchable? default: FALSE
  • string $sortorder: the sort order (ASC, DESC) default: ASC

Redefinition of:
DataListSource::add_column()
Add a column of data to manage
build_groupby_clause (line 187)

Build a groupBy clause. This uses DB_DataObject's ->groupBy() method

void build_groupby_clause ()

Redefinition of:
SQLDataListSource::build_groupby_clause()
this builds the groupby clause of the query
build_limit_clause (line 200)

Build a limit on the number of results. Uses DB_DataObject's ->limit()

void build_limit_clause ( $offset,  $limit)
  • $offset
  • $limit

Redefinition of:
SQLDataListSource::build_limit_clause()
This function builds the limit clause portion of a DB query.
build_order_clause (line 146)

Set the order of the results. This is done using DB_DataObject's

->orderBy() method

void build_order_clause ()

Redefinition of:
SQLDataListSource::build_order_clause()
This builds the db query ORDER BY clause used to sort the data from the DB.
build_query (line 110)

Calls a bunch of helper functions to setup the internal DB_DataObject for the desired query.

void build_query ([boolean $limit_flag = TRUE])
  • boolean $limit_flag: set a limit on the result size? default: TRUE

Redefinition of:
SQLDataListSource::build_query()
build the entire DB query
build_where_clause (line 129)

Add an SQL WHERE condition to the query. This is done using DB_DAtaObject's

->whereAdd() method

void build_where_clause ()

Redefinition of:
SQLDataListSource::build_where_clause()
This builds the where clause for the query
count (line 224)

Count the number of matching rows in the database. This simply returns the result of a DB_DataObject ->find() command operating on a clone of the internal DB_DataObject (this->_dbdo)

  • return: number of matching results
int count ()

Redefinition of:
SQLDataListSource::count()
find the number of rows to be returned from a query from a table and where clause
do_query (line 68)

Perform the query on the database (executes DB_DataObject's ->find() method)

  • return: number of rows in result set
int do_query ()

Redefinition of:
SQLDataListSource::do_query()
Do the query to the DB and pull in all of the records locally.
get_dbdo (line 242)

Returns the DBDO object

  • return: The stored DB_Dataobject
DB_DataObject get_dbdo ()
get_next_data_row (line 81)

Return the next row of the matching result set as an array.

This method relies on DB_DataObject's ->toArray() method, which calls ->getVarname() on each relevant variable.

  • return: array of varname=>display_string representing a db row
array get_next_data_row ()

Redefinition of:
SQLDataListSource::get_next_data_row()
This function gets the next data row from the query()
setup_db_options (line 99)

Although technically overloading setup_db_functions from SQLDataListSource, we're using this function to set DB_DataObject values using the native ->setFrom() method

void setup_db_options (array $opts)
  • array $opts: array of values

Redefinition of:
SQLDataListSource::setup_db_options()
Set which DB options to use for this list.

Inherited Methods

Inherited From SQLDataListSource

SQLDataListSource::advanced_search_where_clause()
SQLDataListSource::build_groupby_clause()
SQLDataListSource::build_limit_clause()
SQLDataListSource::build_order_clause()
SQLDataListSource::build_query()
SQLDataListSource::build_search_clause()
SQLDataListSource::build_where_clause()
SQLDataListSource::count()
SQLDataListSource::do_prequery()
SQLDataListSource::do_query()
SQLDataListSource::get_count_column()
SQLDataListSource::get_db_tables()
SQLDataListSource::get_db_values()
SQLDataListSource::get_default_order_case_sensitive()
SQLDataListSource::get_next_data_row()
SQLDataListSource::get_simple_search_case_insensitive()
SQLDataListSource::join_clauses()
SQLDataListSource::search_value_filter()
SQLDataListSource::setup_db_options()
SQLDataListSource::setup_order()
SQLDataListSource::set_count_column()
SQLDataListSource::set_db_groupby_clause()
SQLDataListSource::set_db_tables()
SQLDataListSource::set_db_values()
SQLDataListSource::set_db_where_clause()
SQLDataListSource::set_default_order_case_sensitive()
SQLDataListSource::set_simple_search_case_insensitive()
SQLDataListSource::simple_search_where_clause()
SQLDataListSource::sql_varchar_filter()

Inherited From DataListSource

DataListSource::DataListSource()
DataListSource::add_column()
DataListSource::do_prequery()
DataListSource::do_query()
DataListSource::get_data_index()
DataListSource::get_limit()
DataListSource::get_next_data_row()
DataListSource::get_offset()
DataListSource::get_orderby()
DataListSource::get_reverseorder()
DataListSource::get_searchby()
DataListSource::get_searchby_value()
DataListSource::get_search_type()
DataListSource::get_secondary_orderby()
DataListSource::get_simplesearch_modifier()
DataListSource::get_total_rows()
DataListSource::query()
DataListSource::row_filter()
DataListSource::set_debug()
DataListSource::set_limit()
DataListSource::set_offset()
DataListSource::set_orderby()
DataListSource::set_reverseorder()
DataListSource::set_searchby()
DataListSource::set_searchby_value()
DataListSource::set_search_type()
DataListSource::set_secondary_orderby()
DataListSource::set_simplesearch_modifier()
DataListSource::set_total_rows()
DataListSource::sort()
DataListSource::_is_column_sortable()

Documentation generated on Fri, 28 Jan 2011 08:53:11 -0500 by phpDocumentor 1.4.3