|
| __construct () |
|
| addColumn ($table, $column, $attributes) |
|
| addPrimaryKey ($table, $column) |
|
| addIndex ($name, $table, $column, $unique=false) |
|
| addTable ($table) |
|
| useTable ($table) |
|
| getColumnAttributes ($table, $column) |
|
| getTableIndexes ($table) |
|
| alterColumn ($table, $column, $attributes, $newName='') |
|
| copyTable ($table, $newTable, $withData=false) |
|
| dropColumn ($table, $column) |
|
| dropIndex ($name, $table) |
|
| dropIndexes ($table) |
|
| dropPrimaryKey ($table) |
|
| dropTable ($table) |
|
| renameTable ($table, $newName) |
|
| setTableOptions ($table, $options) |
|
| resetQueue () |
|
| executeQueue ($force=false) |
|
| delete ($table, $criteria) |
|
| insert ($table, $columns, $quoteValue=true) |
|
| update ($table, $columns, $criteria, $quoteValue=true) |
|
| truncate ($table) |
|
| getLastError () |
|
| getLastErrNo () |
|
| dumpTables () |
|
| dumpQueue () |
|
| addToQueue ($sql) |
|
◆ __construct()
◆ addColumn()
addColumn |
( |
|
$table, |
|
|
|
$column, |
|
|
|
$attributes |
|
) |
| |
Add new column for table to the work queue
- Paramètres
-
string | $table | table to contain the column |
string | $column | name of column to add |
string | $attributes | column_definition |
- Renvoie
- bool true if no errors, false if errors encountered
◆ addIndex()
addIndex |
( |
|
$name, |
|
|
|
$table, |
|
|
|
$column, |
|
|
|
$unique = false |
|
) |
| |
Add new index definition for index to work queue
- Paramètres
-
string | $name | name of index to add |
string | $table | table indexed |
string | $column | column or a comma separated list of columns to use as the key |
bool | $unique | true if index is to be unique |
- Renvoie
- bool true if no errors, false if errors encountered
◆ addPrimaryKey()
addPrimaryKey |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Add new primary key definition for table to work queue
- Paramètres
-
string | $table | table |
string | $column | column or comma separated list of columns to use as primary key |
- Renvoie
- bool true if no errors, false if errors encountered
◆ addTable()
Load table schema from database, or starts new empty schema if table does not exist
- Paramètres
-
- Renvoie
- bool true if no errors, false if errors encountered
◆ addToQueue()
addToQueue - utility function to add a statement to the work queue
- Paramètres
-
string | $sql | an SQL/DDL statement to add |
- Renvoie
- void
◆ alterColumn()
alterColumn |
( |
|
$table, |
|
|
|
$column, |
|
|
|
$attributes, |
|
|
|
$newName = '' |
|
) |
| |
Add alter column operation to the work queue
- Paramètres
-
string | $table | table containing the column |
string | $column | column to alter |
string | $attributes | new column_definition |
string | $newName | new name for column, blank to keep same |
- Renvoie
- bool true if no errors, false if errors encountered
◆ copyTable()
copyTable |
( |
|
$table, |
|
|
|
$newTable, |
|
|
|
$withData = false |
|
) |
| |
Loads table schema from database, and adds newTable with that schema to the queue
- Paramètres
-
string | $table | existing table |
string | $newTable | new table |
bool | $withData | true to copy data, false for schema only |
- Renvoie
- bool true if no errors, false if errors encountered
◆ delete()
delete |
( |
|
$table, |
|
|
|
$criteria |
|
) |
| |
Create a DELETE statement and add it to the work queue
- Paramètres
-
string | $table | table |
string | CriteriaElement | $criteria | string where clause or object criteria |
- Renvoie
- bool true if no errors, false if errors encountered
◆ dropColumn()
dropColumn |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Add drop column operation to the work queue
- Paramètres
-
string | $table | table containing the column |
string | $column | column to drop |
- Renvoie
- bool true if no errors, false if errors encountered
◆ dropIndex()
dropIndex |
( |
|
$name, |
|
|
|
$table |
|
) |
| |
Add drop index operation to the work queue
- Paramètres
-
string | $name | name of index to drop |
string | $table | table indexed |
- Renvoie
- bool true if no errors, false if errors encountered
◆ dropIndexes()
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.
- Paramètres
-
string | $table | table indexed |
- Renvoie
- bool true if no errors, false if errors encountered
◆ dropPrimaryKey()
Add drop of PRIMARY key for a table to the work queue
- Paramètres
-
- Renvoie
- bool true if no errors, false if errors encountered
◆ dropTable()
Add drop of table to the work queue
- Paramètres
-
- Renvoie
- bool true if no errors, false if errors encountered
◆ dumpQueue()
dumpQueue - utility function to dump the work queue
- Renvoie
- array work queue
◆ dumpTables()
dumpTables - utility function to dump raw tables array
- Renvoie
- array tables
◆ execSql()
execSql |
( |
|
$sql, |
|
|
|
$force = false |
|
) |
| |
|
protected |
execute an SQL statement
- Paramètres
-
string | $sql | SQL statement to execute |
bool | $force | true to use force updates even in safe requests |
- Renvoie
- mixed result resource if no error, true if no error but no result false if error encountered. Any error message is in $this->lastError;
◆ executeQueue()
executeQueue |
( |
|
$force = false | ) |
|
Executes the work queue
- Paramètres
-
bool | $force | true to force updates even if this is a 'GET' request |
- Renvoie
- bool true if no errors, false if errors encountered
◆ expandQueue()
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.
- Renvoie
- void
◆ fetch()
fetch the next row of a result set
- Paramètres
-
resource | $result | as returned by query |
- Renvoie
- mixed false on error
◆ getColumnAttributes()
getColumnAttributes |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Get column attributes
- Paramètres
-
string | $table | table containing the column |
string | $column | column to alter |
- Renvoie
- string|bool attribute string, or false if error encountered
◆ getLastErrNo()
Return code from last error encountered
- Renvoie
- int last error number
◆ getLastError()
Return message from last error encountered
- Renvoie
- string last error message
◆ getTable()
get table definition from INFORMATION_SCHEMA
- Paramètres
-
- Renvoie
- array|bool table definition array if table exists, true if table not defined, or false on error. Error message in $this->lastError;
◆ getTableIndexes()
getTableIndexes |
( |
|
$table | ) |
|
Get indexes for a table
- Paramètres
-
string | $table | get indexes for this named table |
- Renvoie
- array|bool array of indexes, or false if error encountered
◆ insert()
insert |
( |
|
$table, |
|
|
|
$columns, |
|
|
|
$quoteValue = true |
|
) |
| |
Create an INSERT SQL statement and add it to the work queue.
- Paramètres
-
string | $table | table |
array | $columns | array of 'column'=>'value' entries |
boolean | $quoteValue | true to quote values, false if caller handles quoting |
- Renvoie
- boolean true if no errors, false if errors encountered
◆ name()
Return a table name, prefixed with site table prefix
- Paramètres
-
string | $table | table name to contain prefix |
- Renvoie
- string table name with prefix
◆ quoteIndexColumnName()
quoteIndexColumnName |
( |
|
$columnName | ) |
|
|
protected |
Backtick quote the column names used in index creation.
Handles prefix indexed columns specified as name(length) - i.e. name(20).
- Paramètres
-
string | $columnName | column name to quote with optional prefix length |
- Renvoie
- string
◆ renameTable()
renameTable |
( |
|
$table, |
|
|
|
$newName |
|
) |
| |
Add rename table operation to the work queue
- Paramètres
-
string | $table | table |
string | $newName | new table name |
- Renvoie
- bool true if no errors, false if errors encountered
◆ renderTableCreate()
renderTableCreate |
( |
|
$table, |
|
|
|
$prefixed = false |
|
) |
| |
|
protected |
return SQL to create the table
This method does NOT modify the work queue
- Paramètres
-
string | $table | table |
bool | $prefixed | true to return with table name prefixed |
- Renvoie
- string|false string SQL to create table, or false if errors encountered
◆ resetQueue()
Clear the work queue
- Renvoie
- void
◆ setTableOptions()
setTableOptions |
( |
|
$table, |
|
|
|
$options |
|
) |
| |
Add alter table table_options (ENGINE, DEFAULT CHARSET, etc.) to work queue
- Paramètres
-
string | $table | table |
string | $options | table_options |
- Renvoie
- bool true if no errors, false if errors encountered
◆ tableNotEstablished()
Set lastError as table not established
- Renvoie
- false
◆ truncate()
Add statement to remove all rows from a table to the work queue
- Paramètres
-
- Renvoie
- bool true if no errors, false if errors encountered
◆ update()
update |
( |
|
$table, |
|
|
|
$columns, |
|
|
|
$criteria, |
|
|
|
$quoteValue = true |
|
) |
| |
Create an UPDATE SQL statement and add it to the work queue
- Paramètres
-
string | $table | table |
array | $columns | array of 'column'=>'value' entries |
string | CriteriaElement | $criteria | string where clause or object criteria |
boolean | $quoteValue | true to quote values, false if caller handles quoting |
- Renvoie
- boolean true if no errors, false if errors encountered
◆ useTable()
AddTable only if it exists
- Paramètres
-
- Renvoie
- bool true if table exists, false otherwise
◆ $databaseName
◆ $db
◆ $lastErrNo
◆ $lastError
◆ $queue
◆ $tables
La documentation de cette classe a été générée à partir du fichier suivant :
- XoopsCore25-2.5.11-Beta1/htdocs/class/libraries/vendor/xoops/xmf/src/Database/Tables.php