phpBB API Documentation
Class

dbal_mssql_odbc

class dbal_mssql_odbc extends dbal

Unified ODBC functions Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...

Here we only support MSSQL Server 2000+ because of the provided schema

Properties

$db_connect_id
$query_result
$return_on_error
$transaction
$sql_time
$num_queries
$open_queries
$curtime
$query_hold
$html_hold
$sql_report
$persistency
$user
$server
$dbname
$sql_error_triggered
$sql_error_sql
$sql_error_returned
$transactions
$multi_insert
$sql_layer Current sql layer
$any_char Wildcards for matching any (%) or exactly one (_) character within LIKE expressions
$one_char
$sql_server_version Exact version of the DBAL, directly queried
$last_query_text
$connect_error

Methods

dbal()

Constructor

from dbal
sql_return_on_error($fail = false)

return on error or display error message

from dbal
sql_num_queries($cached = false)

Return number of sql queries and cached sql queries used

from dbal
sql_add_num_queries($cached = false)

Add to query count

from dbal
sql_close()

DBAL garbage collection, close sql connection

from dbal
sql_query_limit($query, $total, $offset, $cache_ttl)

Build LIMIT query Doing some validation here.

from dbal
sql_fetchrowset($query_id = false)

Fetch all rows

from dbal
sql_rowseek($rownum, $query_id)

Seek to given row number rownum is zero-based

from dbal
sql_fetchfield($field, $rownum = false, $query_id = false)

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

from dbal
string sql_like_expression(string $expression)

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

from dbal
bool sql_buffer_nested_transactions()

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

from dbal
sql_transaction($status = 'begin')

SQL Transaction

from dbal
sql_build_array($query, $assoc_ary = false)

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

from dbal
sql_in_set($field, $array, $negate = false, $allow_empty_set = false)

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

from dbal
sql_bit_and(string $column_name, int $bit, string $compare = '')

Run binary AND operator on DB column.

from dbal
sql_bit_or(string $column_name, int $bit, string $compare = '')

Run binary OR operator on DB column.

from dbal
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)

Run more than one insert statement.

from dbal
_sql_validate_value($var)

Function for validating values

from dbal
sql_build_query($query, $array)

Build sql statement from array for select and select distinct statements

from dbal
sql_error($sql = '')

display sql error page

from dbal
sql_report($mode, $query = '')

Explain queries

from dbal
string get_estimated_row_count(string $table_name)

Gets the estimated number of rows in a specified table.

from dbal
string get_row_count(string $table_name)

Gets the exact number of rows in a specified table.

from dbal
sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)

Connect to server

string sql_server_info(bool $raw = false, bool $use_cache = true)

Version information about used database

_sql_transaction($status = 'begin')

SQL Transaction

sql_query($query = '', $cache_ttl)

Base query method

_sql_query_limit($query, $total, $offset, $cache_ttl)

Build LIMIT query

sql_affectedrows()

Return number of affected rows

sql_fetchrow($query_id = false, $debug = false)

Fetch current row

sql_nextid()

Get last inserted id after insert statement

sql_freeresult($query_id = false)

Free sql result

sql_escape($msg)

Escape string used in sql query

_sql_like_expression($expression)

Build LIKE expression

_sql_custom_build($stage, $data)

Build db-specific query data

_sql_error()

return sql error array

_sql_close()

Close sql connection

_sql_report($mode, $query = '')

Build db-specific report

Details

in dbal at line 76
public dbal()

Constructor

in dbal at line 96
public sql_return_on_error($fail = false)

return on error or display error message

Parameters

$fail

in dbal at line 107
public sql_num_queries($cached = false)

Return number of sql queries and cached sql queries used

Parameters

$cached

in dbal at line 115
public sql_add_num_queries($cached = false)

Add to query count

Parameters

$cached

in dbal at line 125
public sql_close()

DBAL garbage collection, close sql connection

in dbal at line 159
public sql_query_limit($query, $total, $offset, $cache_ttl)

Build LIMIT query Doing some validation here.

Parameters

$query
$total
$offset
$cache_ttl

in dbal at line 176
public sql_fetchrowset($query_id = false)

Fetch all rows

Parameters

$query_id

in dbal at line 201
public sql_rowseek($rownum, $query_id)

Seek to given row number rownum is zero-based

Parameters

$rownum
$query_id

in dbal at line 244
public sql_fetchfield($field, $rownum = false, $query_id = false)

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

Parameters

$field
$rownum
$query_id

in dbal at line 279
public string sql_like_expression(string $expression)

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

Parameters

string $expression The expression to use. Every wildcard is escaped, except $this->anychar and $this->onechar

Return Value

string LIKE expression including the keyword!

in dbal at line 292
public bool sql_buffer_nested_transactions()

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

Return Value

bool Whether buffering is required.

in dbal at line 301
public sql_transaction($status = 'begin')

SQL Transaction

Parameters

$status

in dbal at line 370
public sql_build_array($query, $assoc_ary = false)

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

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

Parameters

$query
$assoc_ary

in dbal at line 425
public sql_in_set($field, $array, $negate = false, $allow_empty_set = false)

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

Parameters

$field
$array
$negate
$allow_empty_set

in dbal at line 475
public 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

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

in dbal at line 493
public 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

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

at line 334
public string sql_lower_text(string $column_name)

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

neither varchar nor char).

Parameters

string $column_name The column name to use

Return Value

string A SQL statement like "LOWER($column_name)"

in dbal at line 524
public bool sql_multi_insert(string $table, array $sql_ary)

Run more than one insert statement.

Parameters

string $table table name to run the statements on
array $sql_ary multi-dimensional array holding the statement data.

Return Value

bool false if no statements were executed.

in dbal at line 577
public _sql_validate_value($var)

Function for validating values

Parameters

$var

in dbal at line 598
public sql_build_query($query, $array)

Build sql statement from array for select and select distinct statements

Possible query values: SELECT, SELECT_DISTINCT

Parameters

$query
$array

in dbal at line 701
public sql_error($sql = '')

display sql error page

Parameters

$sql

in dbal at line 771
public sql_report($mode, $query = '')

Explain queries

Parameters

$mode
$query

in dbal at line 969
public string get_estimated_row_count(string $table_name)

Gets the estimated number of rows in a specified table.

Parameters

string $table_name Table name

Return Value

string Number of rows in $table_name. Prefixed with ~ if estimated (otherwise exact).

in dbal at line 983
public string get_row_count(string $table_name)

Gets the exact number of rows in a specified table.

Parameters

string $table_name Table name

Return Value

string Exact number of rows in $table_name.

at line 40
public sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)

Connect to server

Parameters

$sqlserver
$sqluser
$sqlpassword
$database
$port
$persistency
$new_link

at line 100
public string sql_server_info(bool $raw = false, bool $use_cache = true)

Version information about used database

Parameters

bool $raw if true, only return the fetched sqlserverversion
bool $use_cache If true, it is safe to retrieve the value from the cache

Return Value

string sql server version

at line 135
public _sql_transaction($status = 'begin')

SQL Transaction

Parameters

$status

at line 164
public sql_query($query = '', $cache_ttl)

Base query method

Parameters

$query
$cache_ttl

at line 218
public _sql_query_limit($query, $total, $offset, $cache_ttl)

Build LIMIT query

Parameters

$query
$total
$offset
$cache_ttl

at line 250
public sql_affectedrows()

Return number of affected rows

at line 259
public sql_fetchrow($query_id = false, $debug = false)

Fetch current row

Parameters

$query_id
$debug

at line 279
public sql_nextid()

Get last inserted id after insert statement

at line 300
public sql_freeresult($query_id = false)

Free sql result

Parameters

$query_id

at line 326
public sql_escape($msg)

Escape string used in sql query

Parameters

$msg

at line 343
public _sql_like_expression($expression)

Build LIKE expression

Parameters

$expression

at line 352
public _sql_custom_build($stage, $data)

Build db-specific query data

Parameters

$stage
$data

at line 361
public _sql_error()

return sql error array

at line 385
public _sql_close()

Close sql connection

at line 394
public _sql_report($mode, $query = '')

Build db-specific report

Parameters

$mode
$query