Procedural File: dpdb_mysql.php
SOURCE LOCATION: /lib/dpdb_mysql.php
File Overview
MySQL database functions
A very simple layer over MySQL functions, providing the same interface as dpdb_mdb2.php (which is a layer over the MDB2 database abstraction layer). Either this file or dpdb_mdb2.php is included, based on settings in dpuniverse-ini.php. DutchPIPE version 0.4; PHP version 5 LICENSE: This source file is subject to version 1.0 of the DutchPIPE license. If you did not receive a copy of the DutchPIPE license, you can obtain one at http://dutchpipe.org/license/1_0.txt or by sending a note to license@dutchpipe.org, in which case you will be mailed a copy immediately.
Functions
boolean &dp_db_connect(
)
|
|
Connects to the database server and sets it the current database
Prints an error message to the server output in case of an error
| RETURNS: | boolean | MySQL link identifier on success, FALSE on failure |
| SEE: | DPUNIVERSE_MYSQL_HOST, PUNIVERSE_MYSQL_USER, DPUNIVERSE_MYSQL_PASSWORD, http://www.php.net/mysql_connect, http://www.php.net/mysql_select_db, dp_db_query(), dp_db_exec(), dp_db_fetch_one(), dp_db_fetch_row(), dp_db_quote(), dp_db_num_rows(), dp_db_next_id(), dp_db_free() |
mixed dp_db_exec(
string $sql
)
|
|
Sends a MySQL query of type DELETE, INSERT, REPLACE, UPDATE, ...
Prints an error message to the server output in case of an error
PARAMETERS:
|
string |
$sql: |
SQL statement |
dp_db_fetch_one [line 139]
mixed dp_db_fetch_one(
resource $result , int $row , [int $field = 0]
)
|
|
Gets result data
Prints an error message to the server output in case of an error
PARAMETERS:
|
resource |
$result: |
result resource from dp_db_query() |
|
int |
$row: |
row number from result, starts at 0 |
|
int |
$field: |
optional field name or offset, 0 by default |
dp_db_fetch_row [line 158]
mixed &dp_db_fetch_row(
resource $result
)
|
|
Gets a result row as an enumerated array
PARAMETERS:
|
resource |
$result: |
result resource from dp_db_query() |
boolean dp_db_free(
resource $result
)
|
|
Frees result memory
PARAMETERS:
|
resource |
$result: |
result resource from dp_db_query() |
mixed dp_db_next_id(
string $table , string $idColumn
)
|
|
Gets the next primary ID for an INSERT
Prints an error message to the server output in case of an error
PARAMETERS:
|
string |
$table: |
table name |
|
string |
$idColumn: |
field name |
| RETURNS: | mixed | integer with next id, or FALSE on failure |
| SEE: | dp_db_exec() |
dp_db_num_rows [line 194]
mixed dp_db_num_rows(
resource $result
)
|
|
Gets number of rows in result
Prints an error message to the server output in case of an error
PARAMETERS:
|
resource |
$result: |
result resource from dp_db_query() |
| RETURNS: | mixed | number of rows in a result set, or FALSE on failure |
| SEE: | http://www.php.net/mysql_num_rows, dp_db_query() |
mixed dp_db_query(
string $sql
)
|
|
Sends a MySQL query of type SELECT, SHOW, EXPLAIN, DESCRIBE, ...
Prints an error message to the server output in case of an error
PARAMETERS:
|
string |
$sql: |
SQL statement |
mixed dp_db_quote(
string $val , [ $type = NULL] , [ $quote = TRUE] , [ $escWildcards = FALSE]
)
|
|
Escapes special characters in a string for use in a SQL statement
Escapes the value given in the first argument. All other arguments are ignored and only used, when given, by the MDB2 equivalent function.
PARAMETERS:
|
string |
$val: |
string that is to be escaped |
|
|
$type: |
|
|
|
$quote: |
|
|
|
$escWildcards: |
|
| RETURNS: | mixed | escaped string, or FALSE on error |
| SEE: | http://www.php.net/mysql_real_escape_string, dp_db_query(), dp_db_exec() |
|
|