[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/_core/model/db/ -> _upgrade.funcs.php (sommaire)

This file implements functions useful for upgrading DB schema. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

Author: fplanque: Francois PLANQUE
Author: blueyed: Daniel HAHLER
Author: Wordpress team
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}.
License: http://b2evolution.net/about/license.html GNU General Public License (GPL)
Version: $Id: _upgrade.funcs.php,v 1.1 2007/06/25 10:59:00 fplanque Exp $
Poids: 1202 lignes (42 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 3 fonctions

  db_delta()
  db_delta_remove_backticks()
  install_make_db_schema_current()

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

db_delta( $queries, $exclude_types = array()   X-Ref
Get the delta query to adjust the current database according to a given (list of)
"CREATE TABLE"-, "CREATE DATABASE"-, "INSERT"- or "UPDATE"-statement(s).

It's not recommend to use INSERT or UPDATE statements with this function, as they
are just handled "as-is".

NOTE:
- You should use single quotes (') to give string type values (this is in fact
required for ENUM and SET fields).
- KEYs for AUTO_INCREMENT fields should be defined in column_definition, otherwise
we had to detect the key type from the INDEX query and add it to the ALTER/ADD query.
- If a column changes from "NULL" to "NOT NULL" we generate an extra UPDATE query
to prevent "Data truncated for column 'X' at row Y" errors.

The following query types are generated/marked and can be excluded:
- 'create_table'
- 'create_database'
- 'insert'
- 'update'
- 'drop_column'
- 'change_column'
- 'change_default'
- 'add_column'
- 'add_index'
- 'drop_index'
NOTE: it may be needed to merge an 'add_index' or 'drop_index' type query into an
'add_column'/'change_column' query (adding "AUTO_INCREMENT" for example)!

NOTE: collations and charset changes are ignored. It seems quite difficult to support this,
and it seems to be best to handle this "manually".

author: Originally taken from Wordpress, heavily enhanced and modified by blueyed
param: array The list of queries for which the DB should be adjusted
param: array Exclude query types (see list above).
param: boolean Execute generated queries?  TODO: get this outta here!!!! (sooooo bloated!)
return: array The generated queries.

db_delta_remove_backticks($fieldname)   X-Ref
Remove backticks around a field/table name.

"backtick" means "single backquote" (`)

param: string Field name
return: string

install_make_db_schema_current( $display = true )   X-Ref
Alter the DB schema to match the current expected one ({@link $schema_queries}).

param: boolean Display what we've done?



Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics