C:/drupal/includes/database.mysql.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.

Definition in file database.mysql.inc.


Function Documentation

_db_query ( query,
debug = 0 
)

Helper function for db_query().

Definition at line 92 of file database.mysql.inc.

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

Referenced by db_query(), db_query_range(), and db_query_temporary().

Here is the call graph for this function:

db_affected_rows (  ) 

Determine the number of rows changed by the preceding query.

Definition at line 197 of file database.mysql.inc.

Referenced by cache_set(), openid_user_delete(), and variable_set().

db_column_exists ( table,
column 
)

Check if a column exists in the given table.

Definition at line 349 of file database.mysql.inc.

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

Here is the call graph for this function:

db_connect ( url  ) 

Initialize a database connection.

Definition at line 51 of file database.mysql.inc.

References $url, and _db_error_page().

Referenced by db_set_active().

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 313 of file database.mysql.inc.

Referenced by cache_get().

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 364 of file database.mysql.inc.

Referenced by db_rewrite_sql().

db_encode_blob ( data  ) 

Returns a properly formatted Binary Large OBject value.

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

Definition at line 300 of file database.mysql.inc.

Referenced by _db_query_callback().

db_error (  ) 

Determine whether the previous query caused an error.

Definition at line 189 of file database.mysql.inc.

db_escape_string ( text  ) 

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

Definition at line 320 of file database.mysql.inc.

Referenced by _db_query_callback().

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 159 of file database.mysql.inc.

References $result.

Referenced by _menu_delete_item(), _menu_navigation_links_rebuild(), _menu_set_expanded_menus(), _menu_tree_data(), block_admin_configure(), drupal_uninstall_module(), menu_delete_menu_confirm_submit(), menu_edit_menu_submit(), menu_get_item(), menu_get_names(), menu_link_delete(), menu_link_load(), menu_link_save(), menu_local_tasks(), menu_overview_page(), menu_tree_check_access(), menu_tree_page_data(), menu_valid_path(), profile_field_form(), registry_get_parsed_files(), and system_main_admin_page().

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 143 of file database.mysql.inc.

References $result.

Referenced by _comment_delete_thread(), DrupalWebTestCase::_drupalCreateRole(), _locale_export_get_strings(), _locale_import_po(), _locale_parse_js_file(), _locale_rebuild_js(), _locale_translate_seek(), _trigger_get_hook_actions(), actions_do(), actions_get_all_actions(), actions_load(), actions_synchronize(), aggregator_categorize_items(), aggregator_feed_items_load(), aggregator_form_category_validate(), aggregator_form_feed(), aggregator_form_feed_validate(), aggregator_page_categories(), aggregator_page_opml(), aggregator_page_rss(), aggregator_page_sources(), aggregator_view(), block_admin_configure(), blog_feed_last(), blog_feed_user(), blog_page_last(), blog_page_user(), cache_get(), comment_admin_overview(), comment_delete(), comment_edit(), comment_reply(), contact_admin_categories(), contact_mail_page(), db_column_exists(), db_table_exists(), dblog_event(), dblog_overview(), dblog_top(), drupal_get_installed_schema_version(), filter_admin_delete(), filter_admin_format_form_validate(), language_list(), list_themes(), locale_batch_by_component(), locale_batch_by_language(), locale_languages_edit_form(), locale_languages_edit_form_validate(), locale_translate_edit_form(), locale_translate_overview_screen(), module_enable(), module_list(), node_admin_nodes(), openid_user_identities(), path_admin_overview(), poll_page(), poll_votes(), profile_admin_overview(), profile_admin_settings_autocomplete(), profile_autocomplete(), profile_browse(), profile_field_delete(), registry_cache_path_files(), sess_read(), statistics_access_log(), statistics_node_tracker(), statistics_recent_hits(), statistics_top_pages(), statistics_top_referrers(), statistics_top_visitors(), statistics_user_tracker(), system_ip_blocking(), system_modules_uninstall(), system_sql(), taxonomy_autocomplete(), taxonomy_overview_terms(), taxonomy_term_page(), tracker_page(), update_fix_compatibility(), user_admin_account(), user_admin_role(), user_autocomplete(), and variable_init().

db_lock_table ( table  ) 

Lock a table.

Definition at line 328 of file database.mysql.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 230 of file database.mysql.inc.

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

Referenced by _menu_update_parental_status(), aggregator_page_categories(), aggregator_page_rss(), aggregator_page_sources(), blog_feed_last(), blog_feed_user(), menu_edit_menu_validate(), menu_get_item(), menu_link_children_relative_depth(), pager_query(), profile_admin_settings_autocomplete(), profile_autocomplete(), taxonomy_autocomplete(), and user_autocomplete().

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 278 of file database.mysql.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 176 of file database.mysql.inc.

References $result.

Referenced by _batch_page(), DrupalWebTestCase::_drupalCreateRole(), _locale_import_one_string_db(), _menu_update_parental_status(), _registry_check_code(), actions_function_lookup(), block_add_block_form_validate(), block_admin_configure_validate(), comment_multiple_delete_confirm(), db_check_setup(), db_column_exists(), db_last_insert_id(), db_table_exists(), db_version(), drupal_function_exists(), drupal_get_filename(), drupal_is_denied(), drupal_lookup_path(), file_space_used(), filter_admin_format_form_submit(), flood_is_allowed(), install_verify_drupal(), locale_languages_predefined_form_validate(), locale_translate_edit_form_submit(), menu_delete_menu_confirm(), menu_delete_menu_confirm_submit(), menu_edit_menu_submit(), menu_edit_menu_validate(), menu_link_children_relative_depth(), menu_link_save(), node_admin_nodes(), node_configure(), node_multiple_delete_confirm(), node_revision_delete_confirm_submit(), node_type_delete_confirm(), openid_user_add_validate(), pager_query(), path_admin_form_validate(), path_admin_overview(), profile_autocomplete(), profile_field_form_validate(), sess_count(), sess_write(), system_ip_blocking_form_validate(), trigger_assign_form_submit(), trigger_assign_form_validate(), and user_admin_role_validate().

db_status_report ( phase  ) 

Report database status.

Definition at line 20 of file database.mysql.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 342 of file database.mysql.inc.

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

Referenced by update_create_batch_table(), update_fix_d6_requirements(), and update_info_page().

Here is the call graph for this function:

db_unlock_tables (  ) 

Unlock all locked tables.

Definition at line 335 of file database.mysql.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 43 of file database.mysql.inc.

Referenced by db_status_report().


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