[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/database/pdb/datadict/ -> pdbbasedatadict.class.php (sommaire)

(pas de description)

Poids: 894 lignes (33 kb)
Inclus ou requis:0 fois
Référencé: 1 fois
Nécessite: 0 fichiers

Définit 1 class

PDbBaseDataDict:: (31 méthodes):
  Lens_ParseArgs()
  MetaType()
  MetaTables()
  MetaColumns()
  MetaPrimaryKeys()
  MetaIndexes()
  NameQuote()
  TableName()
  ExecuteSQLArray()
  ActualType()
  CreateDatabase()
  CreateIndexSQL()
  DropIndexSQL()
  SetSchema()
  AlterColumnSQL()
  RenameColumnSQL()
  DropColumnSQL()
  DropTableSQL()
  RenameTableSQL()
  CreateTableSQL()
  _Triggers()
  _array_change_key_case()
  _GenFields()
  _IndexesSQL()
  _GetSize()
  _CreateSuffix()
  _IndexSQL()
  _DropAutoIncrement()
  _TableSQL()
  _Options()
  ChangeTableSQL()

Définit 31 fonctions

  ctype_alnum()

Classe: PDbBaseDataDict  - X-Ref

Base class for data dictionaries. Data dictionaries allow to use a meta-language to describe a database schema, which
will be processed by the data dictionary and which will allow to automatically modify a database. This meta-language
is independent of the database being used, so it can be used in different database environments.

Data dictionaries in PDb work in exactly the same way as in ADOdb, please see more details about data dictionaries here:
http://phplens.com/lens/adodb/docs-datadict.htm.

\ingroup PDb
Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')   X-Ref
Parse arguments, treat "text" (text) and 'text' as quotation marks.
To escape, use "" or '' or ))

Will read in "abc def" sans quotes, as: abc def
Same with 'abc def'.
However if `abc def`, then will read in as `abc def`

returns: 2 dimensional array containing parsed tokens.
param: endstmtchar    Character that indicates end of statement
param: tokenchars     Include the following characters in tokens apart from A-Z and 0-9

MetaType($t,$len=-1,$fieldobj=false)   X-Ref
Given a field, return its metatype based on its real type, i.e. 'VARCHAR' would return 'C',
'TIMESTAMP' would return 'T' and so on. This method must be implemented by child classes as each
database has its own data types.

param: t The type
param: len the field length
param: fieldobj
return: Returns a string with the meta type

MetaTables()   X-Ref
Returns information about the tables in the current connection (a list of them)

return: An array with the tables

MetaColumns($tab, $upper=true, $schema=false)   X-Ref
Returns information (the table schema) about the given table

param: tab Name of the table
param: upper
param: schema
return: An array with the table schema

MetaPrimaryKeys($tab,$owner=false,$intkey=false)   X-Ref
Returns information about primary keys in the given table

param: tab Name of the table
param: upper
param: schema
return: An array with information about the primary keys

MetaIndexes($table, $primary = false, $owner = false)   X-Ref
Returns information about indexes in the given table

param: tab Name of the table
param: upper
param: schema
return: An array with information about the indexes

NameQuote($name = NULL)   X-Ref
Adds quotes around a name if necessary

param: name The name that should be quoted
return: The quoted name if it needed any quotes, or unquoted if it didn't

TableName($name)   X-Ref
tbd


ExecuteSQLArray($sql, $continueOnError = true)   X-Ref
Executes the sql array returned by GetTableSQL and GetIndexSQL

param: sql The SQL code to be executed, passed as an array of queries
param: continueOnError Whether to stop after an error or not
return: True if successful or false otherwise

ActualType($meta)   X-Ref
Given a metatype, return its equivalent database type

param: meta The meta-type:
return: Returns a string with the real type

CreateDatabase($dbname,$options=false)   X-Ref
Returns the SQL code necessary to create the given database

param: dbname Name of the new database
param: options Any additional options needed to create the database, or empty as default
return: An array with SQL code needed to create the database

CreateIndexSQL($idxname, $tabname, $flds, $idxoptions = false)   X-Ref
Generates the SQL to create index.

param: idxname Name of the index
param: tabname Name of the table where the index will be created
param: flds Names of the fields on which the index will work
param: idxoptions Options needed to create the index
return: Returns an array of sql strings.

DropIndexSQL($idxname, $tabname = NULL)   X-Ref
Removes an index from a table

param: idxname Name of the index
param: tabname Name of the table in which the index exists
return: Returns an array of SQL strings needed to remove an index

SetSchema($schema)   X-Ref
tbd


AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')   X-Ref
Returns SQL code needed to add a colum to the database table

param: tabname Name of the table
param: flds An array with all the fields that will be added to the database
param: string $tabname table-name
param: string $flds column-name and type for the changed column
param: string $tableflds='' complete defintion of the new table, eg. for postgres, default ''
param: array/string $tableoptions='' options for the new table see CreateTableSQL, default ''
return: An array with SQL code
return: array with SQL strings

RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')   X-Ref
Rename one column

Some DBM's can only do this together with changeing the type of the column (even if that stays the same, eg. mysql)
param: string $tabname table-name
param: string $oldcolumn column-name to be renamed
param: string $newcolumn new column-name
param: string $flds='' complete column-defintion-string like for AddColumnSQL, only used by mysql atm., default=''
return: array with SQL strings

DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')   X-Ref
Drop one column

Some DBM's can't do that on there own, you need to supply the complete defintion of the new table,
to allow, recreating the table and copying the content over to the new table
param: string $tabname table-name
param: string $flds column-name and type for the changed column
param: string $tableflds='' complete defintion of the new table, eg. for postgres, default ''
param: array/string $tableoptions='' options for the new table see CreateTableSQL, default ''
return: array with SQL strings

DropTableSQL($tabname)   X-Ref
Generate the SQL to drop a table

param: tabname Name of the table
return: An array with SQL code to drop the table.

RenameTableSQL($tabname,$newname)   X-Ref
Generate the SQL to rename a table

param: tabname Name of the table
return: An array with SQL code to rename the table.

CreateTableSQL($tabname, $flds, $tableoptions=false)   X-Ref
Generate the SQL to create table. Returns an array of sql strings.

param: tabname Name of the table
param: flds Table schema
param: tableoptions Any extra options needed to create the table
return: An array with SQL code to create the table according to the schema

_Triggers($tabname,$taboptions)   X-Ref


_array_change_key_case($an_array)   X-Ref


_GenFields($flds,$widespacing=false)   X-Ref


_IndexesSQL($tabname,$flds)   X-Ref


_GetSize($ftype, $ty, $fsize, $fprec)   X-Ref


_CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint)   X-Ref
Pas de description

_IndexSQL($idxname, $tabname, $flds, $idxoptions)   X-Ref


_DropAutoIncrement($tabname)   X-Ref


_TableSQL($tabname,$lines,$pkey,$tableoptions)   X-Ref


_Options($opts)   X-Ref
Sanitize options, so that array elements with no keys are promoted to keys


ChangeTableSQL($tablename, $flds, $tableoptions = false)   X-Ref
Generate the SQL to modify the schema of a table

param: tabname Name of the table
param: flds The new table schema
param: tableoptions Any extra options needed
return: An array with SQL code to modify the schema of the given table

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

ctype_alnum($text)   X-Ref
Pas de description



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics