| [ Index ] |
PHP Cross Reference of MantisBT |
[Source view] [Print] [Project Stats]
Database API
| Copyright: | Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org |
| Copyright: | Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net |
| File Size: | 886 lines (25 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| db_connect( $p_dsn, $p_hostname = null, $p_username = null, $p_password = null, $p_database_name = null, $p_db_schema = null, $p_pconnect = false ) X-Ref |
| Open a connection to the database. param: string $p_dsn Database connection string ( specified instead of other params) param: string $p_hostname Database server hostname param: string $p_username database server username param: string $p_password database server password param: string $p_database_name database name param: string $p_db_schema Schema name (only used if database type is DB2) param: bool $p_pconnect Use a Persistent connection to database return: bool indicating if the connection was successful |
| db_is_connected() X-Ref |
| Returns whether a connection to the database exists return: bool indicating if the a database connection has been made |
| db_check_database_support( $p_db_type ) X-Ref |
| Returns whether php supprot for a database is enabled return: bool indicating if php current supports the given database type |
| db_is_mysql() X-Ref |
| Checks if the database driver is MySQL return: bool true if mysql |
| db_is_pgsql() X-Ref |
| Checks if the database driver is PostgreSQL return: bool true if postgres |
| db_is_mssql() X-Ref |
| Checks if the database driver is MS SQL return: bool true if postgres |
| db_is_db2() X-Ref |
| Checks if the database driver is DB2 return: bool true if db2 |
| db_query( $p_query, $p_limit = -1, $p_offset = -1 ) X-Ref |
| execute query, requires connection to be opened An error will be triggered if there is a problem executing the query. param: string $p_query Query string to execute param: int $p_limit Number of results to return param: int $p_offset offset query results for paging return: ADORecordSet|bool adodb result set or false if the query failed. |
| db_query_bound( $p_query, $arr_parms = null, $p_limit = -1, $p_offset = -1 ) X-Ref |
| execute query, requires connection to be opened An error will be triggered if there is a problem executing the query. param: string $p_query Parameterlised Query string to execute param: array $arr_parms Array of parameters matching $p_query param: int $p_limit Number of results to return param: int $p_offset offset query results for paging return: ADORecordSet|bool adodb result set or false if the query failed. |
| db_param() X-Ref |
| Generate a string to insert a parameter into a database query string return: string 'wildcard' matching a paramater in correct ordered format for the current database. |
| db_num_rows( $p_result ) X-Ref |
| Retrieve number of rows returned for a specific database query param: ADORecordSet $p_result Database Query Record Set to retrieve record count for. return: int Record Count |
| db_affected_rows() X-Ref |
| Retrieve number of rows affected by a specific database query param: ADORecordSet $p_result Database Query Record Set to retrieve affected rows for. return: int Affected Rows |
| db_fetch_array( &$p_result ) X-Ref |
| Retrieve the next row returned from a specific database query param: bool|ADORecordSet $p_result Database Query Record Set to retrieve next result for. return: array Database result |
| db_result( $p_result, $p_index1 = 0, $p_index2 = 0 ) X-Ref |
| Retrieve a result returned from a specific database query param: bool|ADORecordSet $p_result Database Query Record Set to retrieve next result for. param: int $p_index1 Row to retrieve (optional) param: int $p_index2 Column to retrieve (optional) return: mixed Database result |
| db_insert_id( $p_table = null, $p_field = "id" ) X-Ref |
| return the last inserted id for a specific database table param: string $p_table a valid database table name return: int last successful insert id |
| db_table_exists( $p_table_name ) X-Ref |
| Check if the specified table exists. param: string $p_table_name a valid database table name return: bool indicating whether the table exists |
| db_index_exists( $p_table_name, $p_index_name ) X-Ref |
| Check if the specified table index exists. param: string $p_table_name a valid database table name param: string $p_index_name a valid database index name return: bool indicating whether the index exists |
| db_field_exists( $p_field_name, $p_table_name ) X-Ref |
| Check if the specified field exists in a given table param: string $p_field_name a database field name param: string $p_table_name a valid database table name return: bool indicating whether the field exists |
| db_field_names( $p_table_name ) X-Ref |
| Retrieve list of fields for a given table param: string $p_table_name a valid database table name return: array array of fields on table |
| db_error_num() X-Ref |
| Returns the last error number. The error number is reset after every call to Execute(). If 0 is returned, no error occurred. return: int last error number |
| db_error_msg() X-Ref |
| 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. return: string last error string |
| db_error( $p_query = null ) X-Ref |
| send both the error number and error message and query (optional) as paramaters for a triggered error |
| db_close() X-Ref |
| close the connection. Not really necessary most of the time since a connection is automatically closed when a page finishes loading. |
| db_prepare_string( $p_string ) X-Ref |
| prepare a string before DB insertion param: string $p_string unprepared string return: string prepared database query string |
| db_prepare_binary_string( $p_string ) X-Ref |
| prepare a binary string before DB insertion param: string $p_string unprepared binary data return: string prepared database query string |
| db_prepare_int( $p_int ) X-Ref |
| prepare a int for database insertion. param: int $p_int integer return: int integer |
| db_prepare_double( $p_double ) X-Ref |
| prepare a double for database insertion. param: double $p_double double return: double double |
| db_prepare_bool( $p_bool ) X-Ref |
| prepare a boolean for database insertion. param: boolean $p_boolean boolean return: int integer representing boolean |
| db_now() X-Ref |
| return current timestamp for DB return: string Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion |
| db_minutes_to_hhmm( $p_min = 0 ) X-Ref |
| convert minutes to a time format [h]h:mm param: int $p_min integer representing number of minutes return: string representing formatted duration string in hh:mm format. |
| db_helper_like( $p_field_name, $p_case_sensitive = false ) X-Ref |
| 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). param: string $p_field_name The name of the field to filter on. param: bool $p_case_sensitive true: case sensitive, false: case insensitive return: string returns (field LIKE 'value') OR (field ILIKE 'value') |
| db_helper_compare_days( $p_date1_id_or_column, $p_date2_id_or_column, $p_limitstring ) X-Ref |
| A helper function to compare two dates against a certain number of days param: $p_date1_id_or_column param: $p_date2_id_or_column param: $p_limitstring return: string returns database query component to compare dates |
| db_count_queries() X-Ref |
| count queries return: int |
| db_count_unique_queries() X-Ref |
| count unique queries return: int |
| db_time_queries() X-Ref |
| get total time for queries return: int |
| db_get_table( $p_option ) X-Ref |
| get database table name return: string containing full database table name |
| db_get_table_list() X-Ref |
| get list database tables return: array containing table names |
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |