XOOPS
2.6.0
|
Public Member Functions | |
__construct () | |
addColumn ($table, $column, $attributes, $position=null) | |
addPrimaryKey ($table, $column) | |
addTable ($table) | |
alterColumn ($table, $column, $attributes, $newName= '', $position=null) | |
copyTable ($table, $newTable, $withData=false) | |
createIndex ($name, $table, $column, $unique=false) | |
delete ($table, $criteria) | |
dropColumn ($table, $column) | |
dropIndex ($name, $table) | |
dropIndexes ($table) | |
dropPrimaryKey ($table) | |
dropTable ($table) | |
dumpQueue () | |
dumpTables () | |
getLastErrNo () | |
getLastError () | |
insert ($table, $columns) | |
name ($table) | |
queueExecute ($force=false) | |
queueReset () | |
renameTable ($table, $newName) | |
renderTableCreate ($table, $prefixed=false) | |
setTableOptions ($table, $options) | |
truncate ($table) | |
update ($table, $columns, $criteria) | |
useTable ($table) | |
Public Attributes | |
const | POSITION_FIRST = 1 |
Protected Attributes | |
$lastErrNo | |
$lastError | |
Private Member Functions | |
& | execSql ($sql, $force=false) |
expandQueue () | |
fetch (&$result) | |
getTable ($table) | |
Private Attributes | |
$db | |
$queue | |
$tables | |
Definition at line 36 of file Tables.php.
Xmf\Database\Tables::__construct | ( | ) |
Constructor
Definition at line 72 of file Tables.php.
References $xoopsDB, Xmf\Language\load(), and Xmf\Database\Tables\queueReset().
Xmf\Database\Tables::addColumn | ( | $table, | |
$column, | |||
$attributes, | |||
$position = null |
|||
) |
Add new column for table to the work queue
string | $table | table to contain the column |
string | $column | name of column to add |
array | $attributes | column_definition |
mixed | $position | FIRST, string of column name to add new column after, or null for natural append |
Definition at line 105 of file Tables.php.
References $i, _DB_XMF_TABLE_IS_NOT_DEFINED, and Xmf\Database\Tables\POSITION_FIRST.
Xmf\Database\Tables::addPrimaryKey | ( | $table, | |
$column | |||
) |
Add new primary key definition for table to work queue
string | $table | table |
string | $column | column or comma separated list of columns to use as primary key |
Definition at line 182 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::addTable | ( | $table | ) |
Load table schema from database, or starts new empty schema if table doesn't exist
string | $table | table |
Definition at line 205 of file Tables.php.
References Xmf\Database\Tables\getTable().
Xmf\Database\Tables::alterColumn | ( | $table, | |
$column, | |||
$attributes, | |||
$newName = '' , |
|||
$position = null |
|||
) |
Add alter column operation to the work queue
string | $table | table containing the column |
string | $column | column to alter |
array | $attributes | new column_definition |
string | $newName | new name for column, blank to keep same |
mixed | $position | FIRST, string of column name to add new column after, or null for no change |
Definition at line 266 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED, and Xmf\Database\Tables\POSITION_FIRST.
Xmf\Database\Tables::copyTable | ( | $table, | |
$newTable, | |||
$withData = false |
|||
) |
Loads table schema from database, and adds newTable with that schema to the queue
string | $table | existing table |
string | $newTable | new table |
bool | $withData | true to copy data, false for schema only |
Definition at line 324 of file Tables.php.
References Xmf\Database\Tables\getTable(), and Xmf\Database\Tables\name().
Xmf\Database\Tables::createIndex | ( | $name, | |
$table, | |||
$column, | |||
$unique = false |
|||
) |
Add new index definition for index to work queue
string | $name | name of index to add |
string | $table | table indexed |
string | $column | column or comma separated list of columns to use as the key |
bool | $unique | true if index is to be unique |
Definition at line 363 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::delete | ( | $table, | |
$criteria | |||
) |
Create DELETE statement and add to queue
string | $table | table |
mixed | $criteria | string where clause or object criteria |
Definition at line 610 of file Tables.php.
References $criteria, and _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::dropColumn | ( | $table, | |
$column | |||
) |
Add drop column operation to the work queue
string | $table | table containing the column |
string | $column | column to drop |
Definition at line 388 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::dropIndex | ( | $name, | |
$table | |||
) |
Add drop index operation to the work queue
string | $name | name of index to drop |
string | $table | table indexed |
Definition at line 413 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::dropIndexes | ( | $table | ) |
Add drop for all (non-PRIMARY) keys for a table to the work queue. This can be used to clean up indexes with automatic names.
string | $table | table indexed |
Definition at line 436 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::dropPrimaryKey | ( | $table | ) |
Add drop of PRIMARY key for a table to the work queue
string | $table | table |
Definition at line 475 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::dropTable | ( | $table | ) |
Add drop of table to the work queue
string | $table | table |
Definition at line 497 of file Tables.php.
Xmf\Database\Tables::dumpQueue | ( | ) |
dumpQueue - development function to dump the work queue
Definition at line 959 of file Tables.php.
Xmf\Database\Tables::dumpTables | ( | ) |
dumpTables - development function to dump raw tables array
Definition at line 949 of file Tables.php.
|
private |
execute an SQL statement
string | $sql | SQL statement to execute |
bool | $force | true to use queryF |
Definition at line 778 of file Tables.php.
Referenced by Xmf\Database\Tables\queueExecute().
|
private |
During processing, tables to be created are put in the queue as an array('createtable'=>tablename) since the definition is not complete. This method will expand those references to the full ddl to create the table.
Definition at line 913 of file Tables.php.
Referenced by Xmf\Database\Tables\queueExecute().
|
private |
fetch the next row of a result set
resource | &$result | as returned by query |
Definition at line 803 of file Tables.php.
References $result.
Xmf\Database\Tables::getLastErrNo | ( | ) |
Return code from last error encountered
Definition at line 939 of file Tables.php.
Xmf\Database\Tables::getLastError | ( | ) |
Return message from last error encountered
Definition at line 929 of file Tables.php.
|
private |
get table definition from INFORMATION_SCHEMA
string | $table | table |
Definition at line 816 of file Tables.php.
References $sql, XoopsBaseConfig\get(), and Xmf\Database\Tables\name().
Referenced by Xmf\Database\Tables\addTable(), Xmf\Database\Tables\copyTable(), and Xmf\Database\Tables\useTable().
Xmf\Database\Tables::insert | ( | $table, | |
$columns | |||
) |
Create an INSERT SQL statement and add to queue.
string | $table | table |
array | $columns | array of 'column'=>'value' entries |
Definition at line 638 of file Tables.php.
References $sql, and _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::name | ( | $table | ) |
Return a table name, prefixed with site table prefix
string | $table | table name to contain prefix |
Definition at line 89 of file Tables.php.
Referenced by Xmf\Database\Tables\copyTable(), Xmf\Database\Tables\getTable(), and Xmf\Database\Tables\renameTable().
Xmf\Database\Tables::queueExecute | ( | $force = false | ) |
Execute the work queue
bool | $force | true to force updates even if this is a 'GET' request |
Definition at line 580 of file Tables.php.
References $result, Xmf\Database\Tables\execSql(), Xmf\Database\Tables\expandQueue(), and Xmf\Database\Tables\renderTableCreate().
Xmf\Database\Tables::queueReset | ( | ) |
Clear the work queue
Definition at line 567 of file Tables.php.
Referenced by Xmf\Database\Tables\__construct().
Xmf\Database\Tables::renameTable | ( | $table, | |
$newName | |||
) |
Add rename table operation to the work queue
string | $table | table |
string | $newName | new table name |
Definition at line 517 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED, and Xmf\Database\Tables\name().
Xmf\Database\Tables::renderTableCreate | ( | $table, | |
$prefixed = false |
|||
) |
return SQL to create the table
string | $table | table |
bool | $prefixed | true to return with table name prefixed |
Definition at line 734 of file Tables.php.
References $sql, and _DB_XMF_TABLE_IS_NOT_DEFINED.
Referenced by Xmf\Database\Tables\queueExecute().
Xmf\Database\Tables::setTableOptions | ( | $table, | |
$options | |||
) |
Add alter table table_options (ENGINE, DEFAULT CHARSET, etc.) to work queue
string | $table | table |
array | $options | table_options |
Definition at line 544 of file Tables.php.
References $options, and _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::truncate | ( | $table | ) |
Add statement to Empty a table to the queue
string | $table | table |
Definition at line 709 of file Tables.php.
References _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::update | ( | $table, | |
$columns, | |||
$criteria | |||
) |
Creates and executes an UPDATE SQL statement.
string | $table | table |
array | $columns | array of 'column'=>'value' entries |
mixed | $criteria | string where clause or object criteria |
Definition at line 672 of file Tables.php.
References $criteria, $sql, and _DB_XMF_TABLE_IS_NOT_DEFINED.
Xmf\Database\Tables::useTable | ( | $table | ) |
AddTable only if it exists
string | $table | table |
Definition at line 240 of file Tables.php.
References Xmf\Database\Tables\getTable().
|
private |
Definition at line 46 of file Tables.php.
|
protected |
Definition at line 66 of file Tables.php.
|
protected |
Definition at line 61 of file Tables.php.
|
private |
Definition at line 56 of file Tables.php.
|
private |
Definition at line 51 of file Tables.php.
const Xmf\Database\Tables::POSITION_FIRST = 1 |
for add/alter column position
Definition at line 41 of file Tables.php.
Referenced by Xmf\Database\Tables\addColumn(), and Xmf\Database\Tables\alterColumn().