Procedural File: database_api.php
Source Location: /core/database_api.php
Page Details:
Database
This is the general interface for all database calls. Modifications required for database support, outside of adodb support should occur here.
Tags:
Includes:
require_once('adodb'.DIRECTORY_SEPARATOR.'adodb.inc.php') [line 35]
requires adodb library
bool $ADODB_FETCH_MODE [line 59]
bool $g_db_connected [line 47]
bool $g_db_log_queries [line 53]
int $g_db_param_count [line 65]
array $g_queries_array [line 41]
PLUGINS_DISABLED [line 923]
db_affected_rows [line 427]
int db_affected_rows(
[ADORecordSet $p_result = Database Query Record Set to retrieve affected rows for.])
|
|
Retrieve number of rows affected by a specific database query
Tags:
Parameters
ADORecordSet |
$p_result |
Database Query Record Set to retrieve affected rows for. |
db_check_database_support [line 140]
bool db_check_database_support(
$p_db_type)
|
|
Returns whether php supprot for a database is enabled
Tags:
Parameters
db_close [line 662]
close the connection. Not really necessary most of the time since a connection is automatically closed when a page finishes loading.
db_connect [line 78]
bool db_connect(
string $p_dsn, [string $p_hostname = null], [string $p_username = null], [string $p_password = null], [string $p_database_name = null], [string $p_db_schema = null], [bool $p_pconnect = false])
|
|
Open a connection to the database.
Tags:
Parameters
string |
$p_dsn |
Database connection string ( specified instead of other params) |
string |
$p_hostname |
Database server hostname |
string |
$p_username |
database server username |
string |
$p_password |
database server password |
string |
$p_database_name |
database name |
string |
$p_db_schema |
Schema name (only used if database type is DB2) |
bool |
$p_pconnect |
Use a Persistent connection to database |
db_count_queries [line 847]
db_count_unique_queries [line 857]
int db_count_unique_queries(
)
|
|
count unique queries
db_error [line 650]
void db_error(
[ $p_query = null])
|
|
send both the error number and error message and query (optional) as paramaters for a triggered error
Tags:
Parameters
db_error_msg [line 640]
Returns the last status or error message. Returns the last status or error message. The error message is reset when Execute() is called. This can return a string even if no error occurs. In general you do not need to call this function unless an ADOdb function returns false on an error.
Tags:
db_error_num [line 628]
Returns the last error number. The error number is reset after every call to Execute(). If 0 is returned, no error occurred.
Tags:
db_fetch_array [line 438]
array db_fetch_array(
&$p_result, bool|ADORecordSet $p_result)
|
|
Retrieve the next row returned from a specific database query
Tags:
Parameters
bool|ADORecordSet |
$p_result |
Database Query Record Set to retrieve next result for. |
|
&$p_result |
|
db_field_exists [line 606]
bool db_field_exists(
string $p_field_name, string $p_table_name)
|
|
Check if the specified field exists in a given table
Tags:
Parameters
string |
$p_field_name |
a database field name |
string |
$p_table_name |
a valid database table name |
db_field_names [line 617]
array db_field_names(
string $p_table_name)
|
|
Retrieve list of fields for a given table
Tags:
Parameters
string |
$p_table_name |
a valid database table name |
db_get_table [line 889]
string db_get_table(
$p_option)
|
|
get database table name
Tags:
Parameters
db_get_table_list [line 906]
array db_get_table_list(
)
|
|
get list database tables
Tags:
db_helper_compare_days [line 828]
string db_helper_compare_days(
$p_date1_id_or_column $p_date1_id_or_column, $p_date2_id_or_column $p_date2_id_or_column, $p_limitstring $p_limitstring)
|
|
A helper function to compare two dates against a certain number of days
Tags:
Parameters
$p_date1_id_or_column |
$p_date1_id_or_column |
|
$p_date2_id_or_column |
$p_date2_id_or_column |
|
$p_limitstring |
$p_limitstring |
|
db_helper_like [line 808]
string db_helper_like(
string $p_field_name, [bool $p_case_sensitive = false])
|
|
A helper function that generates a case-sensitive or case-insensitive like phrase based on the current db type. The field name and value are assumed to be safe to insert in a query (i.e. already cleaned).
Tags:
Parameters
string |
$p_field_name |
The name of the field to filter on. |
bool |
$p_case_sensitive |
true: case sensitive, false: case insensitive |
db_index_exists [line 579]
bool db_index_exists(
string $p_table_name, string $p_index_name)
|
|
Check if the specified table index exists.
Tags:
Parameters
string |
$p_table_name |
a valid database table name |
string |
$p_index_name |
a valid database index name |
db_insert_id [line 532]
int db_insert_id(
[string $p_table = null], [ $p_field = "id"])
|
|
return the last inserted id for a specific database table
Tags:
Parameters
string |
$p_table |
a valid database table name |
|
$p_field |
|
db_is_connected [line 130]
Returns whether a connection to the database exists
Tags:
db_is_db2 [line 224]
Checks if the database driver is DB2
Tags:
db_is_mssql [line 208]
Checks if the database driver is MS SQL
Tags:
db_is_mysql [line 174]
Checks if the database driver is MySQL
Tags:
db_is_pgsql [line 190]
Checks if the database driver is PostgreSQL
Tags:
db_minutes_to_hhmm [line 797]
string db_minutes_to_hhmm(
[int $p_min = 0])
|
|
convert minutes to a time format [h]h:mm
Tags:
Parameters
int |
$p_min |
integer representing number of minutes |
db_now [line 786]
return current timestamp for DB
Tags:
db_num_rows [line 416]
int db_num_rows(
ADORecordSet $p_result)
|
|
Retrieve number of rows returned for a specific database query
Tags:
Parameters
ADORecordSet |
$p_result |
Database Query Record Set to retrieve record count for. |
db_param [line 404]
Generate a string to insert a parameter into a database query string
Tags:
db_prepare_binary_string [line 725]
string db_prepare_binary_string(
string $p_string)
|
|
prepare a binary string before DB insertion
Tags:
Parameters
string |
$p_string |
unprepared binary data |
db_prepare_bool [line 777]
int db_prepare_bool(
$p_bool, boolean $p_boolean)
|
|
prepare a boolean for database insertion.
Tags:
Parameters
boolean |
$p_boolean |
boolean |
|
$p_bool |
|
db_prepare_double [line 766]
double db_prepare_double(
double $p_double)
|
|
prepare a double for database insertion.
Tags:
Parameters
db_prepare_int [line 755]
int db_prepare_int(
int $p_int)
|
|
prepare a int for database insertion.
Tags:
Parameters
db_prepare_string [line 674]
string db_prepare_string(
string $p_string)
|
|
prepare a string before DB insertion
Tags:
Parameters
string |
$p_string |
unprepared string |
db_query [line 247]
ADORecordSet|bool db_query(
string $p_query, [int $p_limit = -1], [int $p_offset = -1])
|
|
execute query, requires connection to be opened An error will be triggered if there is a problem executing the query.
Tags:
Parameters
string |
$p_query |
Query string to execute |
int |
$p_limit |
Number of results to return |
int |
$p_offset |
offset query results for paging |
db_query_bound [line 302]
ADORecordSet|bool db_query_bound(
string $p_query, [array $arr_parms = null], [int $p_limit = -1], [int $p_offset = -1])
|
|
execute query, requires connection to be opened An error will be triggered if there is a problem executing the query.
Tags:
Parameters
string |
$p_query |
Parameterlised Query string to execute |
array |
$arr_parms |
Array of parameters matching $p_query |
int |
$p_limit |
Number of results to return |
int |
$p_offset |
offset query results for paging |
db_result [line 507]
mixed db_result(
bool|ADORecordSet $p_result, [int $p_index1 = 0], [int $p_index2 = 0])
|
|
Retrieve a result returned from a specific database query
Tags:
Parameters
bool|ADORecordSet |
$p_result |
Database Query Record Set to retrieve next result for. |
int |
$p_index1 |
Row to retrieve (optional) |
int |
$p_index2 |
Column to retrieve (optional) |
db_table_exists [line 548]
bool db_table_exists(
string $p_table_name)
|
|
Check if the specified table exists.
Tags:
Parameters
string |
$p_table_name |
a valid database table name |
db_time_queries [line 875]
get total time for queries
|