dbi_affected_rows (line
442)
Returns the number of rows affected by the last INSERT, UPDATE or DELETE.
Note: Use the () function to get error information if the connection fails.
int
dbi_affected_rows
(resource $conn, resource $res)
-
resource
$conn: The database connection
-
resource
$res: The database query resource returned from the () function.
dbi_clear_cache (line
820)
Clear out the db cache.
Return the number of files deleted.
void
dbi_clear_cache
()
dbi_close (line
233)
Closes a database connection.
This is not necessary for any database that uses pooled connections, such as MySQL, but a good programming practice.
bool
dbi_close
(resource $conn)
-
resource
$conn: The database connection.
dbi_connect (line
83)
Opens up a database connection.
Use a pooled connection if the db supports it and the db_persistent setting is enabled.
Notes:
- The database type is determined by the global variable
db_type
- For ODBC, $host is ignored, $database = DSN
- For Oracle, $database = tnsnames name
- Use the () function to get error information
if the connection fails.
resource
dbi_connect
(string $host, string $login, string $password, string $database, [string $lazy = true])
-
string
$host: Hostname of database server
-
string
$login: Database login
-
string
$password: Database login password
-
string
$database: Name of database
-
string
$lazy: Wait until a query to connect?
dbi_error (line
593)
Gets the latest database error message.
string
dbi_error
()
dbi_escape_string (line
657)
Escapes a string accordingly to the DB type.
string
dbi_escape_string
(string $string)
-
string
$string: SQL of query to execute
dbi_execute (line
712)
Executes a SQL query, supporting parameter binding in the ?-style
Note: Use the () function to get error information if the connection fails.
mixed
dbi_execute
(string $sql, [array $params = array ()], [bool $fatalOnError = true], [bool $showError = true])
-
string
$sql: SQL of query to execute. May contain ?-placeholders
-
array
$params: An array containing the values to put in placeolders. These values will be escaped with dbi_escape_string () and will be put in single quotes. A NULL param will be replaced with NULL without quotes around it.
-
bool
$fatalOnError: Abort execution if there is a database error?
-
bool
$showError: Display error to user (including possibly the SQL) if there is a database error?
dbi_fatal_error (line
639)
Displays a fatal database error and aborts execution.
void
dbi_fatal_error
(string $msg, [bool $doExit = true], [bool $showError = true])
-
string
$msg: The database error message.
-
bool
$doExit: Abort execution?
-
bool
$showError: Show the details of the error (possibly including the SQL that caused the error)?
dbi_fetch_row (line
404)
Retrieves a single row from the database and returns it as an array.
Note: We don't use the more useful xxx_fetch_array because not all databases support this function.
Note: Use the () function to get error information if the connection fails.
mixed
dbi_fetch_row
(resource $res)
-
resource
$res: The database query resource returned from the () function.
dbi_free_result (line
558)
Frees a result set.
bool
dbi_free_result
(resource $res)
-
resource
$res: The database query resource returned from the () function.
dbi_get_blob (line
519)
Get a BLOB (binary large object) from the database.
bool
dbi_get_blob
(resource $table, resource $column, resource $key)
-
resource
$table: the table name that contains the blob
-
resource
$column: the table column name for the blob
-
resource
$key: the key for updating the table row
dbi_get_cached_rows (line
736)
Execute a SQL query. First, look to see if the results of this query are in a cache. If they are, then return them. If not, then run the query and store them in the cache. Of course, caching is only performed for SELECT queries.
Anything other than that will clear out the entire cache (until we add more intelligent caching logic).
void
dbi_get_cached_rows
( $sql, [ $params = array ()], [ $fatalOnError = true], [ $showError = true])
-
$sql
-
$params
-
$fatalOnError
-
$showError
dbi_get_debug (line
811)
Get the SQL debug status.
void
dbi_get_debug
()
dbi_init_cache (line
790)
Specify the location of the cache directory.
This directory will need to world-writable if this is a web-based application.
void
dbi_init_cache
( $dir)
dbi_num_cached_queries (line
289)
Return the number of queries that were cached.
void
dbi_num_cached_queries
()
dbi_num_queries (line
281)
Return the number of database queries that were executed.
(This does not included cached queries.)
void
dbi_num_queries
()
dbi_query (line
309)
Executes an SQL query.
Note: Use the () function to get error information if the connection fails.
mixed
dbi_query
(string $sql, [bool $fatalOnError = true], [bool $showError = true])
-
string
$sql: SQL of query to execute.
-
bool
$fatalOnError: Abort execution if there is a database error?
-
bool
$showError: Display error to user (including possibly the SQL) if there is a database error?
dbi_set_debug (line
801)
Enable SQL debugging.
This will keep an array of all SQL queries in the global variable $SQLLOG.
void
dbi_set_debug
([ $status = false])
dbi_update_blob (line
479)
Update a BLOB (binary large object) in the database with the contents of the specified file.
A BLOB field should be created in a separete INSERT statement using NULL as the initial value prior to this call.
bool
dbi_update_blob
(resource $table, resource $column, resource $key, resource $data)
-
resource
$table: the table name that contains the blob
-
resource
$column: the table column name for the blob
-
resource
$key: the key for updating the table row
-
resource
$data: the data to insert