[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/db/ -> dbal.php (summary)

(no description)

Copyright: (c) 2005 phpBB Group
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id$
File Size: 1000 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

dbal:: (24 methods):
  dbal()
  sql_return_on_error()
  sql_num_queries()
  sql_add_num_queries()
  sql_close()
  sql_query_limit()
  sql_fetchrowset()
  sql_rowseek()
  sql_fetchfield()
  sql_like_expression()
  sql_buffer_nested_transactions()
  sql_transaction()
  sql_build_array()
  sql_in_set()
  sql_bit_and()
  sql_bit_or()
  sql_lower_text()
  sql_multi_insert()
  _sql_validate_value()
  sql_build_query()
  sql_error()
  sql_report()
  get_estimated_row_count()
  get_row_count()


Class: dbal  - X-Ref

Database Abstraction Layer

dbal()   X-Ref
Constructor


sql_return_on_error($fail = false)   X-Ref
return on error or display error message


sql_num_queries($cached = false)   X-Ref
Return number of sql queries and cached sql queries used


sql_add_num_queries($cached = false)   X-Ref
Add to query count


sql_close()   X-Ref
DBAL garbage collection, close sql connection


sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)   X-Ref
Build LIMIT query
Doing some validation here.


sql_fetchrowset($query_id = false)   X-Ref
Fetch all rows


sql_rowseek($rownum, &$query_id)   X-Ref
Seek to given row number
rownum is zero-based


sql_fetchfield($field, $rownum = false, $query_id = false)   X-Ref
Fetch field
if rownum is false, the current row is used, else it is pointing to the row (zero-based)


sql_like_expression($expression)   X-Ref
Correctly adjust LIKE expression for special characters
Some DBMS are handling them in a different way

param: string $expression The expression to use. Every wildcard is escaped, except $this->any_char and $this->one_char
return: string LIKE expression including the keyword!

sql_buffer_nested_transactions()   X-Ref
Returns whether results of a query need to be buffered to run a transaction while iterating over them.

return: bool Whether buffering is required.

sql_transaction($status = 'begin')   X-Ref
SQL Transaction


sql_build_array($query, $assoc_ary = false)   X-Ref
Build sql statement from array for insert/update/select statements

Idea for this from Ikonboard
Possible query values: INSERT, INSERT_SELECT, UPDATE, SELECT


sql_in_set($field, $array, $negate = false, $allow_empty_set = false)   X-Ref
Build IN or NOT IN sql comparison string, uses <> or = on single element
arrays to improve comparison speed

param: string    $field                name of the sql column that shall be compared
param: array    $array                array of values that are allowed (IN) or not allowed (NOT IN)
param: bool    $negate                true for NOT IN (), false for IN () (default)
param: bool    $allow_empty_set    If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false.

sql_bit_and($column_name, $bit, $compare = '')   X-Ref
Run binary AND operator on DB column.
Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}"

param: string $column_name The column name to use
param: int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
param: string $compare Any custom SQL code after the check (for example "= 0")

sql_bit_or($column_name, $bit, $compare = '')   X-Ref
Run binary OR operator on DB column.
Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}"

param: string $column_name The column name to use
param: int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
param: string $compare Any custom SQL code after the check (for example "= 0")

sql_lower_text($column_name)   X-Ref
Run LOWER() on DB column of type text (i.e. neither varchar nor char).

param: string $column_name    The column name to use
return: string                A SQL statement like "LOWER($column_name)"

sql_multi_insert($table, &$sql_ary)   X-Ref
Run more than one insert statement.

param: string $table table name to run the statements on
param: array &$sql_ary multi-dimensional array holding the statement data.
return: bool false if no statements were executed.

_sql_validate_value($var)   X-Ref
Function for validating values


sql_build_query($query, $array)   X-Ref
Build sql statement from array for select and select distinct statements

Possible query values: SELECT, SELECT_DISTINCT

sql_error($sql = '')   X-Ref
display sql error page


sql_report($mode, $query = '')   X-Ref
Explain queries


get_estimated_row_count($table_name)   X-Ref
Gets the estimated number of rows in a specified table.

param: string $table_name        Table name
return: string                Number of rows in $table_name.

get_row_count($table_name)   X-Ref
Gets the exact number of rows in a specified table.

param: string $table_name        Table name
return: string                Exact number of rows in $table_name.



Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1