Class SQLDataListSource

Description

Located in Program_Root/widgets/data_list/SQLDataListSource.inc (line 15)

DataListSource
   |
   --SQLDataListSource
Direct descendents
Class Description
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
Variable Summary
mixed $_db_options
mixed $_query
Method Summary
string build_limit_clause (mixed $offset, mixed $limit)
string build_order_clause ()
string build_query ([boolean $limit_flag = TRUE])
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 ()
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)
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)
string sql_varchar_filter (string $value)
Variables
mixed $_db_options = array("values" => "",
"tables" => "",
"where_clause" => "",
"groupby_clause" => "",
"count_column" => "*")
(line 22)

this holds all of the options

that make up the sql query

mixed $_query = "" (line 32)

The entire query built by

build_query()

Inherited Variables

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_not_found_message
DataListSource::$_query_params
Methods
advanced_search_where_clause (line 225)

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 337)

this builds the groupby clause of the query

string build_groupby_clause ()
build_limit_clause (line 454)

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:
build_order_clause (line 317)

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 ()
build_query (line 352)

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/

build_search_clause (line 285)

This method builds the where clause.

string build_search_clause ()
build_where_clause (line 260)

This builds the where clause for the query

  • return:

    the where clause.

string build_where_clause ()
count (line 467)

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:
do_prequery (line 369)
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 426)

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 133)

this returns the current count column

string get_count_column ()
get_db_tables (line 96)

returns the table(s) used in the query

string get_db_tables ()
get_db_values (line 77)

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

string get_db_values ()
get_next_data_row (line 440)

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:
join_clauses (line 143)
void join_clauses ()
search_value_filter (line 237)

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 52)

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

setup_order (line 302)

This function builds the orderby clause for the DB query.

string. setup_order (string $orderby, string $reverseorder)
  • string $orderby:

    - DB table field to order by

  • string $reverseorder:

    - order assension value.

set_count_column (line 124)

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 114)

Sets the groupby clause for the query

void set_db_groupby_clause (string $clause)
  • string $clause:

    name value pairs

set_db_tables (line 87)

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

void set_db_tables (string $tables)
  • string $tables:

    - $tables

set_db_values (line 66)

Set the values we want to select from the db.

void set_db_values (string $values)
  • string $values:

    - $values

set_db_where_clause (line 105)

Set the user portion of the where clause.

void set_db_where_clause (string $where_clause)
  • string $where_clause:

    - name value pairs

simple_search_where_clause (line 177)

this builds the search clause

string simple_search_where_clause ()
sql_varchar_filter (line 250)

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_not_found_message()
DataListSource::get_offset()
DataListSource::get_orderby()
DataListSource::get_reverseorder()
DataListSource::get_searchby()
DataListSource::get_searchby_value()
DataListSource::get_search_type()
DataListSource::get_simplesearch_modifier()
DataListSource::get_total_rows()
DataListSource::query()
DataListSource::row_filter()
DataListSource::set_limit()
DataListSource::set_not_found_message()
DataListSource::set_offset()
DataListSource::set_orderby()
DataListSource::set_reverseorder()
DataListSource::set_searchby()
DataListSource::set_searchby_value()
DataListSource::set_search_type()
DataListSource::set_simplesearch_modifier()
DataListSource::set_total_rows()
DataListSource::sort()
DataListSource::_is_column_sortable()

Documention generated on Thu, 31 Jul 2003 18:32:59 -0700 by phpDocumentor 1.2.0