Class SQLDataListSource

Description

Located in /widgets/data_list/SQLDataListSource.inc (line 18)

DataListSource
   |
   --SQLDataListSource
Direct descendents
Class Description
WordPressSQLDataListSource This SQLDataListSource child class interacts with with the specific DB via the php WordPress DB abstraction objects.
PEARSQLDataListSource This SQLDataListSource child class interacts with with the specific DB via the php PEAR DB abstraction objects.
ADODBSQLDataListSource This SQLDataListSource child class interacts with with the specific DB via the php ADODB DB abstraction objects.
PGSQLDataListSource This SQLDataListSource child class interacts with
PEARDB_DataObjectDataListSource This class provides DB abstraction for phpHtmlLib datalists using DB_DataObjects as the interface
Variable Summary
Method Summary
string build_limit_clause ( $offset,  $limit)
string build_order_clause ()
string build_query ([boolean $limit_flag = TRUE])
string build_where_clause ()
int count ( $tables, [string $where_clause = ''], [ $count_clause = '*'], string $table)
void do_prequery ()
boolean do_query ()
string get_count_column ()
string get_db_tables ()
string get_db_values ()
array() get_next_data_row ()
void join_clauses ()
string search_value_filter (string $value)
void setup_db_options (string $values, string $tables, [string $where_clause = ''], [string $groupby_clause = ''])
string. setup_order (string $orderby, string $reverseorder, [boolean $icase_sort = FALSE])
void set_count_column ( $var)
void set_db_groupby_clause (string $clause)
void set_db_tables (string $tables)
void set_db_values (string $values)
void set_db_where_clause (string $where_clause)
none set_default_order_case_sensitive ([boolean $flag = TRUE])
void set_simple_search_case_insensitive ([boolean $flag = TRUE])
string sql_varchar_filter (string $value)
Variables
mixed $_db_options = array("values" => "",
"tables" => "",
"where_clause" => "",
"groupby_clause" => "",
"count_column" => "*")
(line 25)

this holds all of the options

that make up the sql query

mixed $_default_order_sensitivity = TRUE (line 45)

The flag that tells us to use case sensitive order by as a default.

NOTE: we are case sensitive by default

mixed $_query = "" (line 35)

The entire query built by

build_query()

mixed $_simple_search_case_insensitive = TRUE (line 54)

The flag to make the simple search where clause case insensitive for the search column.

NOTE: we are case insensitive by default

Inherited Variables

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_debug
DataListSource::$_query_params
Methods
advanced_search_where_clause (line 247)

This function is responsible for building the portion of the where clause for doing an advanced search.

NOTE: the child class MUST override this method

  • return: - portion of the where clause
string advanced_search_where_clause ()
build_groupby_clause (line 380)

this builds the groupby clause of the query

string build_groupby_clause ()

Redefined in descendants as:
build_limit_clause (line 497)

This function builds the limit clause portion of a DB query.

This is specific to the particular DB implementation.

  • return: - the limit portion of the query.
string build_limit_clause ( $offset,  $limit)
  • $offset
  • $limit

Redefined in descendants as:
build_order_clause (line 350)

This builds the db query ORDER BY clause used to sort the data from the DB.

  • return: - the order by clause
string build_order_clause ()

Redefined in descendants as:
build_query (line 395)

build the entire DB query

  • return: - the full query string to the DB.
string build_query ([boolean $limit_flag = TRUE])
  • boolean $limit_flag: - build the limit clause or not/

Redefined in descendants as:
build_search_clause (line 307)

This method builds the where clause.

string build_search_clause ()
build_where_clause (line 282)

This builds the where clause for the query

  • return: the where clause.
string build_where_clause ()

Redefined in descendants as:
count (line 510)

find the number of rows to be returned from a query from a table and where clause

  • return: the # of rows
int count ( $tables, [string $where_clause = ''], [ $count_clause = '*'], string $table)
  • string $table: - the table to count from
  • string $where_clause: - a where clause
  • $tables
  • $count_clause

Redefined in descendants as:
do_prequery (line 412)
void do_prequery ()

Redefinition of:
DataListSource::do_prequery()
This is a method that should be defined by the child class to do any pre-query type of things.
do_query (line 469)

Do the query to the DB and pull in all of the records locally.

  • return: - the query passed/failed.
boolean do_query ()

Redefinition of:
DataListSource::do_query()
This is the function that does the data fetching, and sorting if needed.

Redefined in descendants as:
get_count_column (line 155)

this returns the current count column

string get_count_column ()
get_db_tables (line 118)

returns the table(s) used in the query

string get_db_tables ()
get_db_values (line 99)

This function returns the values we need to search for in the sql query

string get_db_values ()
get_default_order_case_sensitive (line 532)

This function is used to get the flag for the ability to sort/order by case sensitive or not.

none get_default_order_case_sensitive (boolean 0)
  • boolean 0: - TRUE = case sensitive by default
get_next_data_row (line 483)

This function gets the next data row from the query()

array() get_next_data_row ()

Redefinition of:
DataListSource::get_next_data_row()
This function gets the next data row from the query()

Redefined in descendants as:
get_simple_search_case_insensitive (line 554)

This function is used to get the flag that tells the simple search clause method to enable the lower() function which will make the search case insensitive.

  • return: - TRUE - case insensitive
boolean get_simple_search_case_insensitive ()
join_clauses (line 165)
void join_clauses ()
search_value_filter (line 259)

This function does the variable cleaning that is required to use a search value in a sql query

  • return: - the "cleaned" string
string search_value_filter (string $value)
  • string $value: - the origina string from the user
setup_db_options (line 74)

Set which DB options to use for this list.

void setup_db_options (string $values, string $tables, [string $where_clause = ''], [string $groupby_clause = ''])
  • string $values: - $values - the values you want to select from the db table(s)
  • string $tables: - $tables - The tables you want to select on.
  • string $where_clause: - $where_clause - portion of the where clause. This expects name=value pairs only.
  • string $groupby_clause: - $groupby_clause - the groupby portion of the query. same format as where_clause

Redefined in descendants as:
setup_order (line 325)

This function builds the orderby clause for the DB query.

string. setup_order (string $orderby, string $reverseorder, [boolean $icase_sort = FALSE])
  • string $orderby: - DB table field to order by
  • string $reverseorder: - order assension value.
  • boolean $icase_sort: - case insensitive sort?
set_count_column (line 146)

This function changes the counted column.

By default, we use count(1) But sometime you need count(distinct KEY) for example

void set_count_column ( $var)
  • $var
set_db_groupby_clause (line 136)

Sets the groupby clause for the query

void set_db_groupby_clause (string $clause)
  • string $clause: name value pairs
set_db_tables (line 109)

Set the tables from the DB you want to select on.

void set_db_tables (string $tables)
  • string $tables: - $tables
set_db_values (line 88)

Set the values we want to select from the db.

void set_db_values (string $values)
  • string $values: - $values
set_db_where_clause (line 127)

Set the user portion of the where clause.

void set_db_where_clause (string $where_clause)
  • string $where_clause: - name value pairs
set_default_order_case_sensitive (line 521)

This function is used to set the flag for the ability to sort/order by case sensitive or not.

none set_default_order_case_sensitive ([boolean $flag = TRUE])
  • boolean $flag: - TRUE = case sensitive by default
set_simple_search_case_insensitive (line 543)

This function is used to set the flag that tells the simple search clause method to enable the lower() function which will make the search case insensitive.

void set_simple_search_case_insensitive ([boolean $flag = TRUE])
  • boolean $flag: - TRUE - case insensitive
simple_search_where_clause (line 199)

this builds the search clause

string simple_search_where_clause ()
sql_varchar_filter (line 272)

Clean up the string so it can work in a db

string sql_varchar_filter (string $value)
  • string $value

Inherited Methods

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:13 -0500 by phpDocumentor 1.4.3