C:/drupal/includes/database.mysqli.inc File Reference

Go to the source code of this file.


Functions

 db_status_report ($phase)
 db_version ()
 db_connect ($url)
 _db_query ($query, $debug=0)
 db_fetch_object ($result)
 db_fetch_array ($result)
 db_result ($result)
 db_error ()
 db_affected_rows ()
 db_query_range ($query)
 db_query_temporary ($query)
 db_encode_blob ($data)
 db_decode_blob ($data)
 db_escape_string ($text)
 db_lock_table ($table)
 db_unlock_tables ()
 db_table_exists ($table)
 db_column_exists ($table, $column)
 db_distinct_field ($table, $field, $query)


Detailed Description

Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.

Definition in file database.mysqli.inc.


Function Documentation

_db_query ( query,
debug = 0 
)

Helper function for db_query().

Definition at line 93 of file database.mysqli.inc.

References $name, $result, check_plain(), print, and variable_get().

Here is the call graph for this function:

db_affected_rows (  ) 

Determine the number of rows changed by the preceding query.

Definition at line 200 of file database.mysqli.inc.

db_column_exists ( table,
column 
)

Check if a column exists in the given table.

Definition at line 352 of file database.mysqli.inc.

References db_escape_table(), db_fetch_object(), and db_query().

Here is the call graph for this function:

db_connect ( url  ) 

Initialise a database connection.

Note that mysqli does not support persistent connections.

Definition at line 57 of file database.mysqli.inc.

References $url, and _db_error_page().

Here is the call graph for this function:

db_decode_blob ( data  ) 

Returns text from a Binary Large OBject value.

Parameters:
$data Data to decode.
Returns:
Decoded data.

Definition at line 316 of file database.mysqli.inc.

db_distinct_field ( table,
field,
query 
)

Wraps the given table.field entry with a DISTINCT(). The wrapper is added to the SELECT list entry of the given query and the resulting query is returned. This function only applies the wrapper if a DISTINCT doesn't already exist in the query.

Parameters:
$table Table containing the field to set as DISTINCT
$field Field to set as DISTINCT
$query Query to apply the wrapper to
Returns:
SQL query with the DISTINCT wrapper surrounding the given table.field.

Definition at line 367 of file database.mysqli.inc.

db_encode_blob ( data  ) 

Returns a properly formatted Binary Large Object value.

Parameters:
$data Data to encode.
Returns:
Encoded data.

Definition at line 303 of file database.mysqli.inc.

db_error (  ) 

Determine whether the previous query caused an error.

Definition at line 192 of file database.mysqli.inc.

db_escape_string ( text  ) 

Prepare user input for use in a database query, preventing SQL injection attacks.

Definition at line 323 of file database.mysqli.inc.

db_fetch_array ( result  ) 

Fetch one result row from the previous query as an array.

Parameters:
$result A database query result resource, as returned from db_query().
Returns:
An associative array representing the next row of the result, or FALSE. The keys of this object are the names of the table fields selected by the query, and the values are the field values for this result row.

Definition at line 161 of file database.mysqli.inc.

References $result.

db_fetch_object ( result  ) 

Fetch one result row from the previous query as an object.

Parameters:
$result A database query result resource, as returned from db_query().
Returns:
An object representing the next row of the result, or FALSE. The attributes of this object are the table fields selected by the query.

Definition at line 144 of file database.mysqli.inc.

References $result.

db_lock_table ( table  ) 

Lock a table.

Definition at line 331 of file database.mysqli.inc.

References db_escape_table(), and db_query().

Here is the call graph for this function:

db_query_range ( query  ) 

Runs a limited-range query in the active database.

Use this as a substitute for db_query() when a subset of the query is to be returned. User-supplied arguments to the query should be passed in as separate parameters so that they can be properly escaped to avoid SQL injection attacks.

Parameters:
$query A string containing an SQL query.
... A variable number of arguments which are substituted into the query using printf() syntax. The query arguments can be enclosed in one array instead. Valid -modifiers are: s, d, f, b (binary data, do not enclose in '') and %%.
NOTE: using this syntax will cast NULL and FALSE values to decimal 0, and TRUE values to decimal 1.

Parameters:
$from The first result row to return.
$count The maximum number of result rows to return.
Returns:
A database query result resource, or FALSE if the query was not executed correctly.

Definition at line 233 of file database.mysqli.inc.

References _db_query(), _db_query_callback(), and db_prefix_tables().

Here is the call graph for this function:

db_query_temporary ( query  ) 

Runs a SELECT query and stores its results in a temporary table.

Use this as a substitute for db_query() when the results need to stored in a temporary table. Temporary tables exist for the duration of the page request. User-supplied arguments to the query should be passed in as separate parameters so that they can be properly escaped to avoid SQL injection attacks.

Note that if you need to know how many results were returned, you should do a SELECT COUNT(*) on the temporary table afterwards. db_affected_rows() does not give consistent result across different database types in this case.

Parameters:
$query A string containing a normal SELECT SQL query.
... A variable number of arguments which are substituted into the query using printf() syntax. The query arguments can be enclosed in one array instead. Valid -modifiers are: s, d, f, b (binary data, do not enclose in '') and %%.
NOTE: using this syntax will cast NULL and FALSE values to decimal 0, and TRUE values to decimal 1.

Parameters:
$table The name of the temporary table to select into. This name will not be prefixed as there is no risk of collision.
Returns:
A database query result resource, or FALSE if the query was not executed correctly.

Definition at line 281 of file database.mysqli.inc.

References _db_query(), _db_query_callback(), and db_prefix_tables().

Here is the call graph for this function:

db_result ( result  ) 

Return an individual result field from the previous query.

Only use this function if exactly one field is being selected; otherwise, use db_fetch_object() or db_fetch_array().

Parameters:
$result A database query result resource, as returned from db_query().
Returns:
The resulting field or FALSE.

Definition at line 179 of file database.mysqli.inc.

References $result.

db_status_report ( phase  ) 

Report database status.

Definition at line 23 of file database.mysqli.inc.

References db_version(), get_t(), and l().

Here is the call graph for this function:

db_table_exists ( table  ) 

Check if a table exists.

Definition at line 345 of file database.mysqli.inc.

References db_escape_table(), db_fetch_object(), and db_query().

Here is the call graph for this function:

db_unlock_tables (  ) 

Unlock all locked tables.

Definition at line 338 of file database.mysqli.inc.

References db_query().

Here is the call graph for this function:

db_version (  ) 

Returns the version of the database server currently in use.

Returns:
Database server version

Definition at line 46 of file database.mysqli.inc.


Generated on Mon Jun 2 15:08:04 2008 for SimpleTest by  1.5.5