db_affected_rows [line 425]
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
Parameters:
|
ADORecordSet |
$p_result: |
Database Query Record Set to retrieve affected rows for. |
API Tags:
db_bind_date [line 749]
string db_bind_date(
string|int $p_date
)
|
|
prepare a date for binding in the format database accepts.
Parameters:
|
string|int |
$p_date: |
can be a Unix integer timestamp or an ISO format Y-m-d. If null or false or '' is passed in, it will be converted to an SQL null. |
API Tags:
| Return: | Formatted Date for DB insertion e.g. 1970-01-01 ready for database insertion |
db_bind_timestamp [line 760]
string db_bind_timestamp(
string|int $p_date, [bool $p_gmt = false]
)
|
|
prepare a date/time for binding in the format database accepts.
Parameters:
|
string|int |
$p_date: |
can be a Unix integer timestamp or an ISO format Y-m-d h:m:s. If null or false or '' is passed in, it will be converted to an SQL null. |
|
bool |
$p_gmt: |
whether to use GMT or current timezone (default false) |
API Tags:
| Return: | Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion |
db_check_database_support [line 148]
bool db_check_database_support(
$p_db_type
)
|
|
Returns whether php supprot for a database is enabled
Parameters:
API Tags:
| Return: | indicating if php current supports the given database type |
db_close [line 658]
close the connection.
Not really necessary most of the time since a connection is automatically closed when a page finishes loading.
db_connect [line 84]
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.
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 |
API Tags:
| Return: | indicating if the connection was successful |
db_count_queries [line 954]
db_count_unique_queries [line 964]
int db_count_unique_queries(
)
|
|
count unique queries
db_date [line 856]
string db_date(
[$p_timestamp $p_timestamp = null], [bool $p_gmt = false]
)
|
|
convert unix timestamp to db compatible date
Parameters:
|
bool |
$p_gmt: |
whether to use GMT or current timezone (default false) |
|
$p_timestamp |
$p_timestamp: |
Date |
API Tags:
Information Tags:
| Todo: | review date handling |
db_error [line 646]
void db_error(
[ $p_query = null]
)
|
|
send both the error number and error message and query (optional) as paramaters for a triggered error
Parameters:
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_error_msg [line 636]
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.
API Tags:
| Return: | last error string |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_error_num [line 624]
Returns the last error number. The error number is reset after every call to Execute(). If 0 is returned, no error occurred.
API Tags:
| Return: | last error number |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_fetch_array [line 436]
array db_fetch_array(
&$p_result, bool|ADORecordSet $p_result
)
|
|
Retrieve the next row returned from a specific database query
Parameters:
|
bool|ADORecordSet |
$p_result: |
Database Query Record Set to retrieve next result for. |
|
|
&$p_result: |
|
API Tags:
db_field_exists [line 604]
bool db_field_exists(
string $p_field_name, string $p_table_name
)
|
|
Check if the specified field exists in a given table
Parameters:
|
string |
$p_field_name: |
a database field name |
|
string |
$p_table_name: |
a valid database table name |
API Tags:
| Return: | indicating whether the field exists |
db_field_names [line 614]
array db_field_names(
string $p_table_name
)
|
|
Retrieve list of fields for a given table
Parameters:
|
string |
$p_table_name: |
a valid database table name |
API Tags:
| Return: | array of fields on table |
db_get_table [line 996]
string db_get_table(
$p_option
)
|
|
get database table name
Parameters:
API Tags:
| Return: | containing full database table name |
db_get_table_list [line 1013]
array db_get_table_list(
)
|
|
get list database tables
API Tags:
| Return: | containing table names |
db_helper_compare_days [line 914]
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
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: |
|
API Tags:
| Return: | returns database query component to compare dates |
Information Tags:
| Todo: | Check if there is a way to do that using ADODB rather than implementing it here. |
db_helper_like [line 894]
string db_helper_like(
string $p_field_name, [bool $p_case_sensitive = false], int $p_param_id
)
|
|
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).
Parameters:
|
string |
$p_field_name: |
The name of the field to filter on. |
|
int |
$p_param_id: |
An integer pointing to use for a query_bound value that will represent the value that includes the pattern (can include % for wild cards) - not including the quotations. |
|
bool |
$p_case_sensitive: |
true: case sensitive, false: case insensitive |
API Tags:
| Return: | returns (field LIKE 'value') OR (field ILIKE 'value') |
db_index_exists [line 577]
bool db_index_exists(
string $p_table_name, string $p_index_name
)
|
|
Check if the specified table index exists.
Parameters:
|
string |
$p_table_name: |
a valid database table name |
|
string |
$p_index_name: |
a valid database index name |
API Tags:
| Return: | indicating whether the index exists |
db_insert_id [line 530]
int db_insert_id(
[string $p_table = null], [ $p_field = "id"]
)
|
|
return the last inserted id for a specific database table
Parameters:
|
string |
$p_table: |
a valid database table name |
|
|
$p_field: |
|
API Tags:
| Return: | last successful insert id |
db_is_connected [line 138]
Returns whether a connection to the database exists
API Tags:
| Return: | indicating if the a database connection has been made |
| Global: | stores $g_db_connected: database connection state |
db_is_db2 [line 232]
Checks if the database driver is DB2
API Tags:
db_is_mssql [line 216]
Checks if the database driver is MS SQL
API Tags:
db_is_mysql [line 182]
Checks if the database driver is MySQL
API Tags:
db_is_pgsql [line 198]
Checks if the database driver is PostgreSQL
API Tags:
db_minutes_to_hhmm [line 882]
string db_minutes_to_hhmm(
[int $p_min = 0]
)
|
|
convert minutes to a time format [h]h:mm
Parameters:
|
int |
$p_min: |
integer representing number of minutes |
API Tags:
| Return: | representing formatted duration string in hh:mm format. |
db_now [line 807]
return current timestamp for DB
API Tags:
| Return: | Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion |
Information Tags:
| Todo: | add param bool $p_gmt whether to use GMT or current timezone (default false) |
db_null_date [line 871]
return a DB compatible date, representing a unixtime(0) + 1 second. Internally considered a NULL date
API Tags:
| Return: | Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion |
db_num_rows [line 414]
int db_num_rows(
ADORecordSet $p_result
)
|
|
Retrieve number of rows returned for a specific database query
Parameters:
|
ADORecordSet |
$p_result: |
Database Query Record Set to retrieve record count for. |
API Tags:
db_param [line 402]
Generate a string to insert a parameter into a database query string
API Tags:
| Return: | 'wildcard' matching a paramater in correct ordered format for the current database. |
db_prepare_binary_string [line 721]
string db_prepare_binary_string(
string $p_string
)
|
|
prepare a binary string before DB insertion
Parameters:
|
string |
$p_string: |
unprepared binary data |
API Tags:
| Return: | prepared database query string |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_prepare_bool [line 798]
int db_prepare_bool(
$p_bool, boolean $p_boolean
)
|
|
prepare a boolean for database insertion.
Parameters:
|
boolean |
$p_boolean: |
boolean |
|
|
$p_bool: |
|
API Tags:
| Return: | integer representing boolean |
| Deprecated: | db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_prepare_double [line 787]
double db_prepare_double(
double $p_double
)
|
|
prepare a double for database insertion.
Parameters:
API Tags:
| Return: | double |
| Deprecated: | db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_prepare_int [line 776]
int db_prepare_int(
int $p_int
)
|
|
prepare a int for database insertion.
Parameters:
API Tags:
| Return: | integer |
| Deprecated: | db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final |
Information Tags:
| Todo: | Use/Behaviour of this function should be reviewed before 1.2.0 final |
db_prepare_string [line 670]
string db_prepare_string(
string $p_string
)
|
|
prepare a string before DB insertion
Parameters:
|
string |
$p_string: |
unprepared string |
API Tags:
| Return: | prepared database query string |
| Deprecated: | db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final |
db_query [line 255]
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.
Parameters:
|
string |
$p_query: |
Query string to execute |
|
int |
$p_limit: |
Number of results to return |
|
int |
$p_offset: |
offset query results for paging |
API Tags:
| Return: | adodb result set or false if the query failed. |
| Global: | array $g_queries_array: of previous executed queries for profiling |
| Global: | adodb $g_db: database connection object |
| Global: | boolean $g_db_log_queries: indicating whether queries array is populated |
| Deprecated: | db_query_bound should be used in preference to this function. This function will likely be removed in 1.2.0 final |
db_query_bound [line 307]
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.
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 |
API Tags:
| Return: | adodb result set or false if the query failed. |
| Global: | array $g_queries_array: of previous executed queries for profiling |
| Global: | adodb $g_db: database connection object |
| Global: | boolean $g_db_log_queries: indicating whether queries array is populated |
db_result [line 505]
mixed db_result(
bool|ADORecordSet $p_result, [int $p_index1 = 0], [int $p_index2 = 0]
)
|
|
Retrieve a result returned from a specific database query
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) |
API Tags:
db_table_exists [line 546]
bool db_table_exists(
string $p_table_name
)
|
|
Check if the specified table exists.
Parameters:
|
string |
$p_table_name: |
a valid database table name |
API Tags:
| Return: | indicating whether the table exists |
db_timestamp [line 820]
string db_timestamp(
[$p_date $p_date = null], [bool $p_gmt = false]
)
|
|
generate a date/time in database format of a date
Parameters:
|
bool |
$p_gmt: |
whether to use GMT or current timezone (default false) |
|
$p_date |
$p_date: |
Date |
API Tags:
| Return: | Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion |
Information Tags:
| Todo: | review date handling |
db_time_queries [line 982]
get total time for queries
db_unixtimestamp [line 838]
int db_unixtimestamp(
[$p_date $p_date = null], [bool $p_gmt = false]
)
|
|
generate a integer unixtimestamp of a date
Parameters:
|
bool |
$p_gmt: |
whether to use GMT or current timezone (default false) |
|
$p_date |
$p_date: |
Date |
API Tags:
| Return: | unix timestamp of a date |
Information Tags:
| Todo: | review date handling |