[ Index ]
 

Code source de Drupal 5.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/ -> database.inc (sommaire)

(pas de description)

Poids: 318 lignes (11 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 7 fonctions

  db_prefix_tables()
  db_set_active()
  _db_query_callback()
  db_query()
  _db_rewrite_sql()
  db_rewrite_sql()
  db_escape_table()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

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_query_callback($match, $init = FALSE)   X-Ref
Helper function for db_query().


db_query($query)   X-Ref
Runs a basic query in the active database.

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.

param: $query
param: ...
return:

_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_escape_table($string)   X-Ref
Restrict a dynamic tablename to safe characters.

Only keeps alphanumeric and underscores.



Généré le : Fri Nov 30 16:20:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics