Docs For Class SQLDataListSource

## Class SQLDataListSource

Description

- author: Walter A. Boring IV <waboring@newsblob.com>

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

    DataListSource
       |
       --SQLDataListSource

Direct descendents

Class | Description
--- | ---
ADODBSQLDataListSource | This SQLDataListSource child class interacts with with the specific DB via the php ADODB DB abstraction objects.
PEARSQLDataListSource | This SQLDataListSource child class interacts with with the specific DB via the php PEAR 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
mixed $_db_options
mixed $_default_order_sensitivity
mixed $_query
mixed $_simple_search_case_insensitive
Method Summary
string advanced_search_where_clause ()
string build_groupby_clause ()
string build_limit_clause (mixed $offset, mixed $limit)
string build_order_clause ()
string build_query ([boolean $limit_flag = TRUE])
string build_search_clause ()
string build_where_clause ()
int count (mixed $tables, [string $where_clause = ''], [mixed $count_clause = '*'], string $table)
void do_prequery ()
boolean do_query ()
string get_count_column ()
string get_db_tables ()
string get_db_values ()
none get_default_order_case_sensitive (boolean 0)
array() get_next_data_row ()
boolean get_simple_search_case_insensitive ()
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 (mixed $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 simple_search_where_clause ()
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:

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

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 (mixed $offset, mixed $limit)

Redefined in descendants as:

- ADODBSQLDataListSource::build_limit_clause() : This function builds the limit clause portion of a DB query.
- PEARSQLDataListSource::build_limit_clause() : This function builds the limit clause portion of a DB query.
- PGSQLDataListSource::build_limit_clause() : This function builds the limit clause portion of a DB query.
- PEARDB_DataObjectDataListSource::build_limit_clause() : Build a limit on the number of results. Uses DB_DataObject's ->limit()

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:

- PEARDB_DataObjectDataListSource::build_order_clause() : Set the order of the results. This is done using DB_DataObject's

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:

- PEARDB_DataObjectDataListSource::build_query() : Calls a bunch of helper functions to setup the internal DB_DataObject for the desired query.

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:

- PEARDB_DataObjectDataListSource::build_where_clause() : Add an SQL WHERE condition to the query. This is done using DB_DAtaObject's

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 (mixed $tables, [string $where_clause = ''], [mixed $count_clause = '*'], string $table)

- string $table: - the table to count from
- string $where_clause: - a where clause

Redefined in descendants as:

- ADODBSQLDataListSource::count() : find the number of rows to be returned from a query from a table and where clause
- PEARSQLDataListSource::count() : find the number of rows to be returned from a query from a table and where clause
- PGSQLDataListSource::count() : find the number of rows to be returned from a query from a table and where clause
- PEARDB_DataObjectDataListSource::count() : 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)

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:

- ADODBSQLDataListSource::do_query() : This is the function that does the data fetching, and sorting if needed.
- PEARSQLDataListSource::do_query() : This is the function that does the data fetching, and sorting if needed.
- PGSQLDataListSource::do_query()
- PEARDB_DataObjectDataListSource::do_query() : Perform the query on the database (executes DB_DataObject's ->find() method)

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:

- ADODBSQLDataListSource::get_next_data_row() : This function gets the next data row from the query()
- PEARSQLDataListSource::get_next_data_row() : This function gets the next data row from the query()
- PGSQLDataListSource::get_next_data_row() : This function gets the next data row from the query()
- PEARDB_DataObjectDataListSource::get_next_data_row() : Return the next row of the matching result set as an array.

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:

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

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 (mixed $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 Thu, 1 Sep 2005 17:06:10 -0700 by phpDocumentor 1.3.0RC3