phpBB3


dbal\dbal
includes/db/dbal.php at line 23

Class dbal

dbal
All Known Subclasses:
dbal_firebird dbal_mssql dbal_mssql_odbc dbal_mssqlnative dbal_mysql dbal_mysqli dbal_oracle dbal_postgres dbal_sqlite

public class dbal

Database Abstraction Layer


Field Summary
mixed

$any_char

Wildcards for matching any (%) or exactly one (_) character within LIKE expressions

mixed

$curtime

mixed

$db_connect_id

mixed

$dbname

mixed

$html_hold

mixed

$multi_insert

mixed

$num_queries

mixed

$one_char

mixed

$open_queries

mixed

$persistency

mixed

$query_hold

mixed

$query_result

mixed

$return_on_error

mixed

$server

mixed

$sql_error_returned

mixed

$sql_error_sql

mixed

$sql_error_triggered

mixed

$sql_layer

Current sql layer

mixed

$sql_report

mixed

$sql_server_version

Exact version of the DBAL, directly queried

mixed

$sql_time

mixed

$transaction

mixed

$transactions

mixed

$user

Constructor Summary
void

__construct()

Constructor

Method Summary
void

sql_return_on_error(bool fail)

return on error or display error message

void

sql_num_queries(bool cached)

Return number of sql queries and cached sql queries used

void

sql_add_num_queries(bool cached)

Add to query count

void

sql_close()

DBAL garbage collection, close sql connection

void

sql_query_limit(mixed query, mixed total, int offset, int cache_ttl)

Build LIMIT query Doing some validation here.

void

sql_fetchrowset(bool query_id)

Fetch all rows

void

sql_rowseek(mixed rownum, mixed query_id)

Seek to given row number rownum is zero-based

void

sql_fetchfield(mixed field, bool rownum, bool query_id)

Fetch field if rownum is false, the current row is used, else it is pointing to the row (zero-based)

string

sql_like_expression(string expression)

Correctly adjust LIKE expression for special characters Some DBMS are handling them in a different way

bool

sql_buffer_nested_transactions()

Returns whether results of a query need to be buffered to run a transaction while iterating over them.

void

sql_build_array(mixed query, bool assoc_ary)

Build sql statement from array for insert/update/select statementsIdea for this from Ikonboard Possible query values: INSERT, INSERT_SELECT, UPDATE, SELECT

void

sql_in_set(string field, array array, bool negate, bool allow_empty_set)

Build IN or NOT IN sql comparison string, uses or = on single element arrays to improve comparison speed

void

sql_bit_and(string column_name, int bit, string compare)

Run binary AND operator on DB column.

void

sql_bit_or(string column_name, int bit, string compare)

Run binary OR operator on DB column.

string

sql_lower_text(string column_name)

Run LOWER() on DB column of type text (i.e.

bool

sql_multi_insert(string table, array &$sql_ary, mixed sql_ary)

Run more than one insert statement.

void

sql_build_query(mixed query, mixed array)

Build sql statement from array for select and select distinct statementsPossible query values: SELECT, SELECT_DISTINCT

void

sql_error(str sql)

display sql error page

void

sql_report(mixed mode, str query)

Explain queries

string

get_estimated_row_count(string table_name)

Gets the estimated number of rows in a specified table.

string

get_row_count(string table_name)

Gets the exact number of rows in a specified table.

Field Detail

includes/db/dbal.php at line 65

any_char

public mixed $any_char

Wildcards for matching any (%) or exactly one (_) character within LIKE expressions


includes/db/dbal.php at line 33

curtime

public mixed $curtime = 0

includes/db/dbal.php at line 25

db_connect_id

public mixed $db_connect_id = 80

includes/db/dbal.php at line 41

dbname

public mixed $dbname = ''

includes/db/dbal.php at line 35

html_hold

public mixed $html_hold = ''

includes/db/dbal.php at line 55

multi_insert

public mixed $multi_insert = false

includes/db/dbal.php at line 30

num_queries

public mixed $num_queries = array()

includes/db/dbal.php at line 66

one_char

public mixed $one_char

includes/db/dbal.php at line 31

open_queries

public mixed $open_queries = array()

includes/db/dbal.php at line 38

persistency

public mixed $persistency = false

includes/db/dbal.php at line 34

query_hold

public mixed $query_hold = ''

includes/db/dbal.php at line 26

query_result

public mixed $query_result

includes/db/dbal.php at line 27

return_on_error

public mixed $return_on_error = false

includes/db/dbal.php at line 40

server

public mixed $server = ''

includes/db/dbal.php at line 49

sql_error_returned

public mixed $sql_error_returned = array()

includes/db/dbal.php at line 47

sql_error_sql

public mixed $sql_error_sql = ''

includes/db/dbal.php at line 44

sql_error_triggered

public mixed $sql_error_triggered = false

includes/db/dbal.php at line 60

sql_layer

public mixed $sql_layer = ''

Current sql layer


includes/db/dbal.php at line 36

sql_report

public mixed $sql_report = ''

includes/db/dbal.php at line 71

sql_server_version

public mixed $sql_server_version = false

Exact version of the DBAL, directly queried


includes/db/dbal.php at line 29

sql_time

public mixed $sql_time = 0

includes/db/dbal.php at line 28

transaction

public mixed $transaction = false

includes/db/dbal.php at line 52

transactions

public mixed $transactions = 0

includes/db/dbal.php at line 39

user

public mixed $user = ''

Constructor Detail

includes/db/dbal.php at line 76

__construct

public void __construct()

Constructor


Method Detail

includes/db/dbal.php at line 96

sql_return_on_error

public void sql_return_on_error(bool fail)

return on error or display error message


includes/db/dbal.php at line 107

sql_num_queries

public void sql_num_queries(bool cached)

Return number of sql queries and cached sql queries used


includes/db/dbal.php at line 115

sql_add_num_queries

public void sql_add_num_queries(bool cached)

Add to query count


includes/db/dbal.php at line 125

sql_close

public void sql_close()

DBAL garbage collection, close sql connection


includes/db/dbal.php at line 159

sql_query_limit

public void sql_query_limit(mixed query, mixed total, int offset, int cache_ttl)

Build LIMIT query Doing some validation here.


includes/db/dbal.php at line 176

sql_fetchrowset

public void sql_fetchrowset(bool query_id)

Fetch all rows


includes/db/dbal.php at line 201

sql_rowseek

public void sql_rowseek(mixed rownum, mixed query_id)

Seek to given row number rownum is zero-based


includes/db/dbal.php at line 244

sql_fetchfield

public void sql_fetchfield(mixed field, bool rownum, bool query_id)

Fetch field if rownum is false, the current row is used, else it is pointing to the row (zero-based)


includes/db/dbal.php at line 279

sql_like_expression

public string sql_like_expression(string expression)

Correctly adjust LIKE expression for special characters Some DBMS are handling them in a different way

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

includes/db/dbal.php at line 292

sql_buffer_nested_transactions

public bool sql_buffer_nested_transactions()

Returns whether results of a query need to be buffered to run a transaction while iterating over them.

Returns:
Whether buffering is required.

includes/db/dbal.php at line 370

sql_build_array

public void sql_build_array(mixed query, bool assoc_ary)

Build sql statement from array for insert/update/select statements

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


includes/db/dbal.php at line 425

sql_in_set

public void sql_in_set(string field, array array, bool negate, bool allow_empty_set)

Build IN or NOT IN sql comparison string, uses <> or = on single element arrays to improve comparison speed

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

includes/db/dbal.php at line 475

sql_bit_and

public void sql_bit_and(string column_name, int bit, string compare)

Run binary AND operator on DB column. Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}"

Parameters:
column_name - The column name to use
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
compare - Any custom SQL code after the check (for example "= 0")

includes/db/dbal.php at line 493

sql_bit_or

public void sql_bit_or(string column_name, int bit, string compare)

Run binary OR operator on DB column. Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}"

Parameters:
column_name - The column name to use
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
compare - Any custom SQL code after the check (for example "= 0")

includes/db/dbal.php at line 510

sql_lower_text

public string sql_lower_text(string column_name)

Run LOWER() on DB column of type text (i.e. neither varchar nor char).

Parameters:
column_name - The column name to use
Returns:
A SQL statement like "LOWER($column_name)"

includes/db/dbal.php at line 524

sql_multi_insert

public bool sql_multi_insert(string table, array &$sql_ary, mixed sql_ary)

Run more than one insert statement.

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

includes/db/dbal.php at line 598

sql_build_query

public void sql_build_query(mixed query, mixed array)

Build sql statement from array for select and select distinct statements

Possible query values: SELECT, SELECT_DISTINCT


includes/db/dbal.php at line 701

sql_error

public void sql_error(str sql)

display sql error page


includes/db/dbal.php at line 771

sql_report

public void sql_report(mixed mode, str query)

Explain queries


includes/db/dbal.php at line 969

get_estimated_row_count

public string get_estimated_row_count(string table_name)

Gets the estimated number of rows in a specified table.

Parameters:
table_name - Table name
Returns:
Number of rows in $table_name. Prefixed with ~ if estimated (otherwise exact).

includes/db/dbal.php at line 983

get_row_count

public string get_row_count(string table_name)

Gets the exact number of rows in a specified table.

Parameters:
table_name - Table name
Returns:
Exact number of rows in $table_name.

phpBB3