class mssql_odbc extends mssql_base
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
Constants
LOGICAL_OP |
|
STATEMENTS |
|
LEFT_STMT |
|
COMPARE_OP |
|
RIGHT_STMT |
|
SUBQUERY_OP |
|
SUBQUERY_SELECT_TYPE |
|
SUBQUERY_BUILD |
|
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
__construct()
Constructor |
from driver | |
string |
get_sql_layer()
Gets the name of the sql layer. |
from driver |
string |
get_db_name()
Gets the name of the database. |
from driver |
string |
get_any_char()
Wildcards for matching any (%) character within LIKE expressions |
from driver |
string |
get_one_char()
Wildcards for matching exactly one (_) character within LIKE expressions |
from driver |
mixed |
get_db_connect_id()
Gets the connect ID. |
from driver |
bool |
get_sql_error_triggered()
Indicates if an error was triggered. |
from driver |
string |
get_sql_error_sql()
Gets the last faulty query |
from driver |
bool |
get_transaction()
Indicates if we are in a transaction. |
from driver |
int |
get_sql_time()
Gets the time spent into the queries |
from driver |
array |
get_sql_error_returned()
Gets the returned error. |
from driver |
bool |
get_multi_insert()
Indicates if multiple insertion can be used |
from driver |
set_multi_insert(bool $multi_insert)
Set if multiple insertion can be used |
from driver | |
null |
sql_return_on_error(bool $fail = false)
Return on error or display error message |
from driver |
sql_num_queries($cached = false)
Return number of sql queries and cached sql queries used |
from driver | |
null |
sql_add_num_queries(bool $cached = false)
Add to query count |
from driver |
sql_close()
DBAL garbage collection, close SQL connection |
from driver | |
sql_query_limit($query, $total, $offset, $cache_ttl)
Build LIMIT query |
from driver | |
sql_fetchrowset($query_id = false)
Fetch all rows |
from driver | |
sql_rowseek($rownum, $query_id)
Seek to given row number |
from driver | |
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 driver | |
string |
sql_like_expression($expression)
Correctly adjust LIKE expression for special characters Some DBMS are handling them in a different way |
from driver |
string |
sql_not_like_expression($expression)
Correctly adjust NOT LIKE expression for special characters Some DBMS are handling them in a different way |
from driver |
sql_case($condition, $action_true, $action_false = false)
Build a case expression |
from driver | |
sql_concatenate($expr1, $expr2)
Build a concatenated expression |
from mssql_base | |
bool |
sql_buffer_nested_transactions()
Returns whether results of a query need to be buffered to run a transaction while iterating over them. |
from driver |
sql_transaction($status = 'begin')
SQL Transaction |
from driver | |
sql_build_array($query, $assoc_ary = false)
Build sql statement from an array |
from driver | |
string |
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 driver |
string |
sql_bit_and(string $column_name, int $bit, string $compare = '')
Run binary AND operator on DB column. |
from driver |
string |
sql_bit_or(string $column_name, int $bit, string $compare = '')
Run binary OR operator on DB column. |
from driver |
string |
cast_expr_to_bigint(string $expression)
Returns SQL string to cast a string expression to an int. |
from mssql_base |
string |
cast_expr_to_string($expression)
Returns SQL string to cast an integer expression to a string. |
from driver |
string |
sql_lower_text(string $column_name)
Run LOWER() on DB column of type text (i.e. |
from mssql_base |
bool |
sql_multi_insert(string $table, array $sql_ary)
Run more than one insert statement. |
from driver |
_sql_validate_value($var)
Function for validating values |
from driver | |
sql_build_query($query, $array)
Build sql statement from array for select and select distinct statements |
from driver | |
mixed |
sql_error(string $sql = '')
Display sql error page |
from driver |
sql_report($mode, $query = '')
Explain queries |
from driver | |
string |
get_estimated_row_count(string $table_name)
Gets the estimated number of rows in a specified table. |
from driver |
string |
get_row_count(string $table_name)
Gets the exact number of rows in a specified table. |
from driver |
sql_escape($msg)
Escape string used in sql query |
from mssql_base | |
_sql_like_expression($expression)
Build LIKE expression |
from mssql_base | |
_sql_not_like_expression($expression)
Build NOT LIKE expression |
from mssql_base | |
_sql_custom_build($stage, $data)
Build db-specific query data |
from mssql_base | |
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)
Fetch current row |
||
sql_nextid()
Get last inserted id after insert statement |
||
sql_freeresult($query_id = false)
Free sql result |
||
_sql_error()
return sql error array |
||
_sql_close()
Close sql connection |
||
_sql_report($mode, $query = '')
Build db-specific report |
Details
in driver at line 81
public
__construct()
Constructor
in driver at line 101
public string
get_sql_layer()
Gets the name of the sql layer.
in driver at line 109
public string
get_db_name()
Gets the name of the database.
in driver at line 117
public string
get_any_char()
Wildcards for matching any (%) character within LIKE expressions
in driver at line 125
public string
get_one_char()
Wildcards for matching exactly one (_) character within LIKE expressions
in driver at line 133
public mixed
get_db_connect_id()
Gets the connect ID.
in driver at line 141
public bool
get_sql_error_triggered()
Indicates if an error was triggered.
in driver at line 149
public string
get_sql_error_sql()
Gets the last faulty query
in driver at line 157
public bool
get_transaction()
Indicates if we are in a transaction.
in driver at line 165
public int
get_sql_time()
Gets the time spent into the queries
in driver at line 173
public array
get_sql_error_returned()
Gets the returned error.
in driver at line 181
public bool
get_multi_insert()
Indicates if multiple insertion can be used
in driver at line 189
public
set_multi_insert(bool $multi_insert)
Set if multiple insertion can be used
in driver at line 197
public null
sql_return_on_error(bool $fail = false)
Return on error or display error message
in driver at line 208
public
sql_num_queries($cached = false)
Return number of sql queries and cached sql queries used
in driver at line 216
public null
sql_add_num_queries(bool $cached = false)
Add to query count
in driver at line 226
public
sql_close()
DBAL garbage collection, close SQL connection
in driver at line 259
public
sql_query_limit($query, $total, $offset, $cache_ttl)
Build LIMIT query
in driver at line 276
public
sql_fetchrowset($query_id = false)
Fetch all rows
in driver at line 300
public
sql_rowseek($rownum, $query_id)
Seek to given row number
in driver at line 342
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)
in driver at line 373
public string
sql_like_expression($expression)
Correctly adjust LIKE expression for special characters Some DBMS are handling them in a different way
in driver at line 384
public string
sql_not_like_expression($expression)
Correctly adjust NOT LIKE expression for special characters Some DBMS are handling them in a different way
in driver at line 395
public
sql_case($condition, $action_true, $action_false = false)
Build a case expression
Note: The two statements actiontrue and actionfalse must have the same data type (int, vchar, ...) in the database!
in mssql_base at line 24
public
sql_concatenate($expr1, $expr2)
Build a concatenated expression
in driver at line 415
public bool
sql_buffer_nested_transactions()
Returns whether results of a query need to be buffered to run a transaction while iterating over them.
in driver at line 423
public
sql_transaction($status = 'begin')
SQL Transaction
in driver at line 490
public
sql_build_array($query, $assoc_ary = false)
Build sql statement from an array
in driver at line 538
public string
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
in driver at line 580
public string
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}"
in driver at line 593
public string
sql_bit_or(string $column_name, int $bit, string $compare = '')
Run binary OR operator on DB column.
in mssql_base at line 66
public string
cast_expr_to_bigint(string $expression)
Returns SQL string to cast a string expression to an int.
in driver at line 614
public string
cast_expr_to_string($expression)
Returns SQL string to cast an integer expression to a string.
in mssql_base at line 40
public string
sql_lower_text(string $column_name)
Run LOWER() on DB column of type text (i.e.
neither varchar nor char).
in driver at line 630
public bool
sql_multi_insert(string $table, array $sql_ary)
Run more than one insert statement.
in driver at line 683
public
_sql_validate_value($var)
Function for validating values
in driver at line 702
public
sql_build_query($query, $array)
Build sql statement from array for select and select distinct statements
Possible query values: SELECT, SELECT_DISTINCT
in driver at line 941
public mixed
sql_error(string $sql = '')
Display sql error page
in driver at line 1011
public
sql_report($mode, $query = '')
Explain queries
in driver at line 1202
public string
get_estimated_row_count(string $table_name)
Gets the estimated number of rows in a specified table.
in driver at line 1210
public string
get_row_count(string $table_name)
Gets the exact number of rows in a specified table.
in mssql_base at line 32
public
sql_escape($msg)
Escape string used in sql query
in mssql_base at line 49
public
_sql_like_expression($expression)
Build LIKE expression
in mssql_base at line 58
public
_sql_not_like_expression($expression)
Build NOT LIKE expression
in mssql_base at line 75
public
_sql_custom_build($stage, $data)
Build db-specific query data
at line 33
public
sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
Connect to server
at line 90
public string
sql_server_info(bool $raw = false, bool $use_cache = true)
Version information about used database
at line 125
public
_sql_transaction($status = 'begin')
SQL Transaction
at line 148
public
sql_query($query = '', $cache_ttl)
Base query method
at line 215
public
_sql_query_limit($query, $total, $offset, $cache_ttl)
Build LIMIT query
at line 247
public
sql_affectedrows()
Return number of affected rows
at line 255
public
sql_fetchrow($query_id = false)
Fetch current row
at line 275
public
sql_nextid()
Get last inserted id after insert statement
at line 296
public
sql_freeresult($query_id = false)
Free sql result
at line 323
public
_sql_error()
return sql error array
at line 347
public
_sql_close()
Close sql connection
at line 356
public
_sql_report($mode, $query = '')
Build db-specific report