DB_Table
[ class tree: DB_Table ] [ index: DB_Table ] [ all elements ]

Class: DB_Table_Manager

Source Location: /DB_Table-1.5.6/DB/Table/Manager.php

Class Overview


Creates, checks or alters tables from DB_Table definitions.


Author(s):

Version:

  • Release: 1.5.6

Methods


Inherited Variables

Inherited Methods


Class Details

[line 216]
Creates, checks or alters tables from DB_Table definitions.

DB_Table_Manager provides database automated table creation facilities.



[ Top ]


Method Detail

alter   [line 600]

bool|object True alter( object &$db, string $table, mixed $column_set, mixed $index_set)

Alter columns and indexes of a table based on DB_Table column and index arrays.
  • Return: if altering was successful or a PEAR_Error on failure.
  • Access: public

Parameters:

object   &$db     A PEAR DB/MDB2 object.
string   $table     The table name to connect to in the database.
mixed   $column_set     A DB_Table $this->col array.
mixed   $index_set     A DB_Table $this->idx array.

[ Top ]

create   [line 241]

mixed create( object &$db, string $table, mixed $column_set, mixed $index_set)

Create the table based on DB_Table column and index arrays.
  • Return: Boolean false if there was no attempt to create the table, boolean true if the attempt succeeded, and a PEAR_Error if the attempt failed.
  • Access: public

Parameters:

object   &$db     A PEAR DB/MDB2 object.
string   $table     The table name to connect to in the database.
mixed   $column_set     A DB_Table $this->col array.
mixed   $index_set     A DB_Table $this->idx array.

[ Top ]

getDeclare   [line 892]

string|object A getDeclare( string $phptype, string $coltype, [int $size = null], [int $scope = null], [bool $require = null], [string $default = null])

Get the column declaration string for a DB_Table column.
  • Return: declaration string on success, or a PEAR_Error on failure.
  • Access: public

Parameters:

string   $phptype     The DB/MDB2 phptype key.
string   $coltype     The DB_Table column type.
int   $size     The size for the column (needed for string and decimal).
int   $scope     The scope for the column (needed for decimal).
bool   $require     True if the column should be NOT NULL, false allowed to be NULL.
string   $default     The SQL calculation for a default value.

[ Top ]

getDeclareForIndex   [line 1071]

string getDeclareForIndex( string $phptype, string $type, string $idxname, string $table, mixed $cols)

Get the index declaration string for a DB_Table index.
  • Return: A declaration string.
  • Access: public

Parameters:

string   $phptype     The DB phptype key.
string   $type     The index type.
string   $idxname     The index name.
string   $table     The table name.
mixed   $cols     Array with the column names for the index.

[ Top ]

getDeclareMDB2   [line 990]

string|object A getDeclareMDB2( string $coltype, [int $size = null], [int $scope = null], [bool $require = null], [string $default = null], &$max_scope, int $max_scope)

Get the column declaration string for a DB_Table column.
  • Return: MDB2 column definition array on success, or a PEAR_Error on failure.
  • Access: public

Parameters:

string   $coltype     The DB_Table column type.
int   $size     The size for the column (needed for string and decimal).
int   $scope     The scope for the column (needed for decimal).
bool   $require     True if the column should be NOT NULL, false allowed to be NULL.
string   $default     The SQL calculation for a default value.
int   $max_scope     The maximal scope for all table column (pass-by-reference).
   &$max_scope     

[ Top ]

getIndexes   [line 1559]

mixed getIndexes( object &$db, string $table)

Return all indexes for a table.
  • Return: Array with all indexes or a PEAR_Error when an error occured.
  • Access: public

Parameters:

object   &$db     A PEAR DB/MDB2 object.
string   $table     The table name.

[ Top ]

tableExists   [line 848]

bool|object True tableExists( object &$db, string $table)

Check whether a table exists.
  • Return: if the table exists, false if not, or a PEAR_Error on failure.
  • Access: public

Parameters:

object   &$db     A PEAR DB/MDB2 object.
string   $table     The table name that should be checked.

[ Top ]

verify   [line 468]

mixed verify( object &$db, string $table, mixed $column_set, mixed $index_set)

Verify whether the table and columns exist, whether the columns have the right type and whether the indexes exist.
  • Return: Boolean true if the verification was successful, and a PEAR_Error if verification failed.
  • Access: public

Parameters:

object   &$db     A PEAR DB/MDB2 object.
string   $table     The table name to connect to in the database.
mixed   $column_set     A DB_Table $this->col array.
mixed   $index_set     A DB_Table $this->idx array.

[ Top ]


Documentation generated on Thu, 25 Dec 2008 15:00:26 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.