[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/includes/ -> database.inc (summary)

(no description)

File Size: 623 lines (22 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 1 file
 includes/install.inc

Defines 14 functions

  update_sql()
  db_prefix_tables()
  db_set_active()
  _db_error_page()
  db_is_active()
  _db_query_callback()
  db_placeholders()
  _db_rewrite_sql()
  db_rewrite_sql()
  db_distinct_field()
  db_escape_table()
  db_create_table()
  db_field_names()
  db_type_placeholder()

Functions
Functions that are not part of a class:

update_sql($sql)   X-Ref
Perform an SQL query and return success or failure.

param: $sql
return:

db_prefix_tables($sql)   X-Ref
Append a database prefix to all tables in a query.

Queries sent to Drupal should wrap all table names in curly brackets. This
function searches for this syntax and adds Drupal's table prefix to all
tables, allowing Drupal to coexist with other systems in the same database if
necessary.

param: $sql
return:

db_set_active($name = 'default')   X-Ref
Activate a database for future queries.

If it is necessary to use external databases in a project, this function can
be used to change where database queries are sent. If the database has not
yet been used, it is initialized using the URL specified for that name in
Drupal's configuration file. If this name is not defined, a duplicate of the
default connection is made instead.

Be sure to change the connection back to the default when done with custom
code.

param: $name
return: the name of the previously active database or FALSE if non was found.

_db_error_page($error = '')   X-Ref
Helper function to show fatal database errors.

Prints a themed maintenance page with the 'Site off-line' text,
adding the provided error message in the case of 'display_errors'
set to on. Ends the page request; no return.

param: $error

db_is_active()   X-Ref
Returns a boolean depending on the availability of the database.


_db_query_callback($match, $init = FALSE)   X-Ref
Helper function for db_query().


db_placeholders($arguments, $type = 'int')   X-Ref
Generate placeholders for an array of query arguments of a single type.

Given a Schema API field type, return correct %-placeholders to
embed in a query

param: $arguments
param: $type

_db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'nid', $args = array()   X-Ref
Helper function for db_rewrite_sql.

Collects JOIN and WHERE statements via hook_db_rewrite_sql()
Decides whether to select primary_key or DISTINCT(primary_key)

param: $query
param: $primary_table
param: $primary_field
param: $args
return:

db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $args = array()   X-Ref
Rewrites node, taxonomy and comment queries. Use it for listing queries. Do not
use FROM table1, table2 syntax, use JOIN instead.

param: $query
param: $primary_table
param: $primary_field
param: $args
return:

db_distinct_field($table, $field, $query)   X-Ref
Adds the DISTINCT flag to the supplied query and returns the altered query.

The supplied query should not contain a DISTINCT flag. This will not, and
never did guarantee that you will obtain distinct values of $table.$field.

param: $table
param: $field
param: $query
return:

db_escape_table($string)   X-Ref
Restrict a dynamic table, column or constraint name to safe characters.

Only keeps alphanumeric and underscores.

db_create_table(&$ret, $name, $table)   X-Ref
Create a new table from a Drupal table definition.

param: $ret
param: $name
param: $table

db_field_names($fields)   X-Ref
Return an array of field names from an array of key/index column specifiers.

This is usually an identity function but if a key/index uses a column prefix
specification, this function extracts just the name.

param: $fields
return:

db_type_placeholder($type)   X-Ref
Given a Schema API field type, return the correct %-placeholder.

Embed the placeholder in a query to be passed to db_query and and pass as an
argument to db_query a value of the specified type.

param: $type
return:



Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7