Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
_CreateSuffix ($fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned) | |
_createSuffix ($fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned) | |
_dropAutoIncrement ($tabname) | |
_genFields ($flds, $widespacing=false) | |
_getSize ($ftype, $ty, $fsize, $fprec, $options=false) | |
GENERATE THE SIZE PART OF THE DATATYPE $ftype is the actual type $ty is the type defined originally in the DDL. | |
_getSizePrec ($size) | |
_IndexSQL ($idxname, $tabname, $flds, $idxoptions) | |
_indexSQL ($idxname, $tabname, $flds, $idxoptions) | |
_options ($opts) | |
Sanitize options, so that array elements with no keys are promoted to keys. | |
_tableSQL ($tabname, $lines, $pkey, $tableoptions) | |
_triggers ($tabname, $taboptions) | |
GENERATE TRIGGERS IF NEEDED used when table has auto-incrementing field that is emulated using triggers. | |
ActualType ($meta) | |
actualType ($meta) | |
Returns the actual type given a character code. | |
AddColumnSQL ($tabname, $flds) | |
addColumnSQL ($tabname, $flds) | |
AlterColumnSQL ($tabname, $flds, $tableflds='', $tableoptions='') | |
alterColumnSQL ($tabname, $flds, $tableflds='', $tableoptions='') | |
Change the definition of one column. | |
changeTableSQL ($tablename, $flds, $tableoptions=false, $dropOldFlds=false) | |
This function changes/adds new fields to your table. | |
createDatabase ($dbname, $options=false) | |
createIndexSQL ($idxname, $tabname, $flds, $idxoptions=false) | |
createTableSQL ($tabname, $flds, $tableoptions=array()) | |
Generate the SQL to create table. | |
DropColumnSQL ($tabname, $flds, $tableflds='', $tableoptions='') | |
dropColumnSQL ($tabname, $flds, $tableflds='', $tableoptions='') | |
Drop one column. | |
dropIndexSQL ($idxname, $tabname=NULL) | |
dropTableSQL ($tabname) | |
executeSQLArray ($sql, $continueOnError=true) | |
getCommentSQL ($table, $col) | |
metaColumns ($tab, $upper=true, $schema=false) | |
metaIndexes ($table, $primary=false, $owner=false) | |
metaPrimaryKeys ($tab, $owner=false, $intkey=false) | |
metaTables () | |
MetaType ($t, $len=-1, $fieldobj=false) | |
metaType ($t, $len=-1, $fieldobj=false) | |
nameQuote ($name=NULL, $allowBrackets=false) | |
renameColumnSQL ($tabname, $oldcolumn, $newcolumn, $flds='') | |
Rename one column. | |
renameTableSQL ($tabname, $newname) | |
setCommentSQL ($table, $col, $cmt) | |
setSchema ($schema) | |
tableName ($name) | |
Public Attributes | |
$addCol = ' ADD' | |
$alterCol = ' ALTER COLUMN' | |
$autoIncrement = false | |
$blobAllowsDefaultValue | |
$blobAllowsNotNull | |
$blobSize = 100 | |
ADOConnection | $connection |
$databaseType = 'sybase' | |
$dataProvider | |
$debug = false | |
$dropCol = ' DROP COLUMN' | |
$dropIndex = 'DROP INDEX %2$s.%1$s' | |
$dropTable = 'DROP TABLE %s' | |
$invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME') | |
$nameRegex = '\w' | |
$nameRegexBrackets = 'a-zA-Z0-9_\(\)' | |
string | $quote |
String to use to quote identifiers and names. | |
$renameColumn = 'ALTER TABLE %s RENAME COLUMN %s TO %s' | |
$renameTable = 'RENAME TABLE %s TO %s' | |
$schema = false | |
$serverInfo = array() | |
string | $upperName |
any varchar/char field this size or greater is treated as a blob in other words, we use a text area for editing. | |
|
inherited |
Returns the actual type given a character code.
C: varchar X: CLOB (character large object) or largest varchar size if CLOB is not supported C2: Multibyte varchar X2: Multibyte CLOB
B: BLOB (binary large object)
D: Date T: Date-time L: Integer field suitable for storing booleans (0 or 1) I: Integer F: Floating point number N: Numeric or decimal number
|
inherited |
Change the definition of one column.
As some DBMs can't do that on their own, you need to supply the complete definition of the new table, to allow recreating the table and copying the content over to the new table
string | $tabname | table-name |
string | $flds | column-name and type for the changed column |
string | $tableflds,='' | complete definition of the new table, eg. for postgres, default '' |
array | string | $tableoptions,='' | options for the new table see createTableSQL, default '' |
array | with SQL strings |
Reimplemented in ADODB2_db2.
|
inherited |
This function changes/adds new fields to your table.
You don't have to know if the col is new or not. It will check on its own.
string | $tablename | |
string | $flds | |
string[] | $tableoptions | |
bool | $dropOldFlds |
string[] | Array of SQL Commands |
Reimplemented in ADODB2_db2.
|
inherited |
Generate the SQL to create table.
Returns an array of sql strings.
|
inherited |
Drop one column.
Some DBM's can't do that on their own, you need to supply the complete definition of the new table, to allow, recreating the table and copying the content over to the new table
string | $tabname | table-name |
string | $flds | column-name and type for the changed column |
string | $tableflds,='' | complete definition of the new table, eg. for postgres, default '' |
array | string | $tableoptions,='' | options for the new table see createTableSQL, default '' |
array | with SQL strings |
|
inherited |
Rename one column.
Some DBMs can only do this together with changeing the type of the column (even if that stays the same, eg. mysql)
string | $tabname | table-name |
string | $oldcolumn | column-name to be renamed |
string | $newcolumn | new column-name |
string | $flds,='' | complete column-definition-string like for addColumnSQL, only used by mysql atm., default='' |
array | with SQL strings |
|
inherited |
any varchar/char field this size or greater is treated as a blob in other words, we use a text area for editing.
Uppercase driver name