|
| __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
- Parameters
-
string | $table | table to contain the column |
string | $column | name of column to add |
string | $attributes | column_definition |
- Returns
- 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
- Parameters
-
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 |
- Returns
- bool true if no errors, false if errors encountered
◆ addPrimaryKey()
addPrimaryKey |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Add new primary key definition for table to work queue
- Parameters
-
string | $table | table |
string | $column | column or comma separated list of columns to use as primary key |
- Returns
- 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
- Parameters
-
- Returns
- bool true if no errors, false if errors encountered
◆ addToQueue()
addToQueue - utility function to add a statement to the work queue
- Parameters
-
string | $sql | an SQL/DDL statement to add |
- Returns
- void
◆ alterColumn()
alterColumn |
( |
|
$table, |
|
|
|
$column, |
|
|
|
$attributes, |
|
|
|
$newName = '' |
|
) |
| |
Add alter column operation to the work queue
- Parameters
-
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 |
- Returns
- 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
- Parameters
-
string | $table | existing table |
string | $newTable | new table |
bool | $withData | true to copy data, false for schema only |
- Returns
- bool true if no errors, false if errors encountered
◆ delete()
delete |
( |
|
$table, |
|
|
|
$criteria |
|
) |
| |
Create a DELETE statement and add it to the work queue
- Parameters
-
string | $table | table |
string | CriteriaElement | $criteria | string where clause or object criteria |
- Returns
- bool true if no errors, false if errors encountered
◆ dropColumn()
dropColumn |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Add drop column operation to the work queue
- Parameters
-
string | $table | table containing the column |
string | $column | column to drop |
- Returns
- bool true if no errors, false if errors encountered
◆ dropIndex()
dropIndex |
( |
|
$name, |
|
|
|
$table |
|
) |
| |
Add drop index operation to the work queue
- Parameters
-
string | $name | name of index to drop |
string | $table | table indexed |
- Returns
- 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.
- Parameters
-
string | $table | table indexed |
- Returns
- bool true if no errors, false if errors encountered
◆ dropPrimaryKey()
Add drop of PRIMARY key for a table to the work queue
- Parameters
-
- Returns
- bool true if no errors, false if errors encountered
◆ dropTable()
Add drop of table to the work queue
- Parameters
-
- Returns
- bool true if no errors, false if errors encountered
◆ dumpQueue()
dumpQueue - utility function to dump the work queue
- Returns
- array work queue
◆ dumpTables()
dumpTables - utility function to dump raw tables array
- Returns
- array tables
◆ execSql()
execSql |
( |
|
$sql, |
|
|
|
$force = false |
|
) |
| |
|
protected |
execute an SQL statement
- Parameters
-
string | $sql | SQL statement to execute |
bool | $force | true to use force updates even in safe requests |
- Returns
- 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
- Parameters
-
bool | $force | true to force updates even if this is a 'GET' request |
- Returns
- 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.
- Returns
- void
◆ fetch()
fetch the next row of a result set
- Parameters
-
resource | $result | as returned by query |
- Returns
- mixed false on error
◆ getColumnAttributes()
getColumnAttributes |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Get column attributes
- Parameters
-
string | $table | table containing the column |
string | $column | column to alter |
- Returns
- string|false attribute string, or false if error encountered
◆ getLastErrNo()
Return code from last error encountered
- Returns
- int last error number
◆ getLastError()
Return message from last error encountered
- Returns
- string last error message
◆ getTable()
get table definition from INFORMATION_SCHEMA
- Parameters
-
- Returns
- 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
- Parameters
-
string | $table | get indexes for this named table |
- Returns
- array|false 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.
- Parameters
-
string | $table | table |
array | $columns | array of 'column'=>'value' entries |
boolean | $quoteValue | true to quote values, false if caller handles quoting |
- Returns
- boolean true if no errors, false if errors encountered
◆ name()
Return a table name, prefixed with site table prefix
- Parameters
-
string | $table | table name to contain prefix |
- Returns
- string table name with prefix
◆ quoteDefaultClause()
quoteDefaultClause |
( |
|
$default | ) |
|
|
protected |
create default value clause for DDL
- Parameters
-
string | null | $default | the default value to be quoted |
- Returns
- string the correctly quoted default value
◆ 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).
- Parameters
-
string | $columnName | column name to quote with optional prefix length |
- Returns
- string
◆ renameTable()
renameTable |
( |
|
$table, |
|
|
|
$newName |
|
) |
| |
Add rename table operation to the work queue
- Parameters
-
string | $table | table |
string | $newName | new table name |
- Returns
- 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
- Parameters
-
string | $table | table |
bool | $prefixed | true to return with table name prefixed |
- Returns
- string|false string SQL to create table, or false if errors encountered
◆ resetQueue()
Clear the work queue
- Returns
- void
◆ setTableOptions()
setTableOptions |
( |
|
$table, |
|
|
|
$options |
|
) |
| |
Add alter table table_options (ENGINE, DEFAULT CHARSET, etc.) to work queue
- Parameters
-
string | $table | table |
string | $options | table_options |
- Returns
- bool true if no errors, false if errors encountered
◆ tableNotEstablished()
Set lastError as table not established
- Returns
- false
◆ truncate()
Add statement to remove all rows from a table to the work queue
- Parameters
-
- Returns
- 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
- Parameters
-
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 |
- Returns
- boolean true if no errors, false if errors encountered
◆ useTable()
AddTable only if it exists
- Parameters
-
- Returns
- bool true if table exists, false otherwise
◆ $databaseName
◆ $db
◆ $lastErrNo
◆ $lastError
◆ $queue
◆ $tables
The documentation for this class was generated from the following file:
- C:/xoops2511b2/htdocs/class/libraries/vendor/xoops/xmf/src/Database/Tables.php