Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
ADODB_DataDict Class Reference
Inheritance diagram for ADODB_DataDict:
ADODB2_access ADODB2_db2 ADODB2_generic ADODB2_ibase ADODB2_informix ADODB2_mssql ADODB2_mysql ADODB2_oci8 ADODB2_sapdb ADODB2_sqlite ADODB2_sybase

Public Member Functions

 _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)
 
 _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)
 Returns the actual type given a character code.
 
 addColumnSQL ($tabname, $flds)
 
 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='')
 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)
 
 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
 
 $dataProvider
 
 $debug = false
 
 $dropCol = ' DROP COLUMN'
 
 $dropIndex = 'DROP INDEX %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.
 

Member Function Documentation

◆ actualType()

ADODB_DataDict::actualType ( $meta)

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

◆ alterColumnSQL()

ADODB_DataDict::alterColumnSQL ( $tabname,
$flds,
$tableflds = '',
$tableoptions = '' )

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

Parameters
string$tabnametable-name
string$fldscolumn-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 ''
Return values
arraywith SQL strings

Reimplemented in ADODB2_db2.

◆ changeTableSQL()

ADODB_DataDict::changeTableSQL ( $tablename,
$flds,
$tableoptions = false,
$dropOldFlds = false )

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.

Parameters
string$tablename
string$flds
string[]$tableoptions
bool$dropOldFlds
Return values
string[]Array of SQL Commands

Reimplemented in ADODB2_db2.

◆ createTableSQL()

ADODB_DataDict::createTableSQL ( $tabname,
$flds,
$tableoptions = array() )

Generate the SQL to create table.

Returns an array of sql strings.

◆ dropColumnSQL()

ADODB_DataDict::dropColumnSQL ( $tabname,
$flds,
$tableflds = '',
$tableoptions = '' )

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

Parameters
string$tabnametable-name
string$fldscolumn-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 ''
Return values
arraywith SQL strings

◆ renameColumnSQL()

ADODB_DataDict::renameColumnSQL ( $tabname,
$oldcolumn,
$newcolumn,
$flds = '' )

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)

Parameters
string$tabnametable-name
string$oldcolumncolumn-name to be renamed
string$newcolumnnew column-name
string$flds,=''complete column-definition-string like for addColumnSQL, only used by mysql atm., default=''
Return values
arraywith SQL strings

Member Data Documentation

◆ $upperName

string ADODB_DataDict::$upperName

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


The documentation for this class was generated from the following file: