Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]

ADOdb Data Dictionary base class. This file is part of ADOdb, a Database Abstraction Layer library for PHP.

Copyright: 2000-2013 John Lim
Copyright: 2014 Damien Regad, Mark Newnham and the ADOdb community
License: BSD-3-Clause
License: LGPL-2.1-or-later
File Size: 1095 lines (29 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ADODB_DataDict:: (32 methods):
  getCommentSQL()
  setCommentSQL()
  metaTables()
  metaColumns()
  metaPrimaryKeys()
  metaIndexes()
  metaType()
  nameQuote()
  tableName()
  executeSQLArray()
  actualType()
  createDatabase()
  createIndexSQL()
  dropIndexSQL()
  setSchema()
  addColumnSQL()
  alterColumnSQL()
  renameColumnSQL()
  dropColumnSQL()
  dropTableSQL()
  renameTableSQL()
  createTableSQL()
  _genFields()
  _getSize()
  _createSuffix()
  _indexSQL()
  _dropAutoIncrement()
  _tableSQL()
  _triggers()
  _options()
  _getSizePrec()
  changeTableSQL()

Defines 32 functions


Class: ADODB_DataDict  - X-Ref

getCommentSQL($table,$col)   X-Ref


setCommentSQL($table,$col,$cmt)   X-Ref
No description

metaTables()   X-Ref
No description

metaColumns($tab, $upper=true, $schema=false)   X-Ref
No description

metaPrimaryKeys($tab,$owner=false,$intkey=false)   X-Ref
No description

metaIndexes($table, $primary = false, $owner = false)   X-Ref
No description

metaType($t,$len=-1,$fieldobj=false)   X-Ref
No description

nameQuote($name = NULL,$allowBrackets=false)   X-Ref
No description

tableName($name)   X-Ref
No description

executeSQLArray($sql, $continueOnError = true)   X-Ref
No description

actualType($meta)   X-Ref
No description

createDatabase($dbname,$options=false)   X-Ref
No description

createIndexSQL($idxname, $tabname, $flds, $idxoptions = false)   X-Ref
No description

dropIndexSQL($idxname, $tabname = NULL)   X-Ref
No description

setSchema($schema)   X-Ref
No description

addColumnSQL($tabname, $flds)   X-Ref
No description

alterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')   X-Ref
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
param: string $tabname table-name
param: string $flds column-name and type for the changed column
param: string $tableflds='' complete definition of the new table, eg. for postgres, default ''
param: array|string $tableoptions='' options for the new table see createTableSQL, default ''
return: array with SQL strings

renameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')   X-Ref
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)
param: string $tabname table-name
param: string $oldcolumn column-name to be renamed
param: string $newcolumn new column-name
param: string $flds='' complete column-definition-string like for addColumnSQL, only used by mysql atm., default=''
return: array with SQL strings

dropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')   X-Ref
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
param: string $tabname table-name
param: string $flds column-name and type for the changed column
param: string $tableflds='' complete definition of the new table, eg. for postgres, default ''
param: array|string $tableoptions='' options for the new table see createTableSQL, default ''
return: array with SQL strings

dropTableSQL($tabname)   X-Ref
No description

renameTableSQL($tabname,$newname)   X-Ref
No description

createTableSQL($tabname, $flds, $tableoptions=array()   X-Ref
No description

_genFields($flds,$widespacing=false)   X-Ref
No description

_getSize($ftype, $ty, $fsize, $fprec, $options=false)   X-Ref
No description

_createSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)   X-Ref
No description

_indexSQL($idxname, $tabname, $flds, $idxoptions)   X-Ref
No description

_dropAutoIncrement($tabname)   X-Ref
No description

_tableSQL($tabname,$lines,$pkey,$tableoptions)   X-Ref
No description

_triggers($tabname,$taboptions)   X-Ref
No description

_options($opts)   X-Ref
No description

_getSizePrec($size)   X-Ref
No description

changeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)   X-Ref
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.

param: string   $tablename
param: string   $flds
param: string[] $tableoptions
param: bool     $dropOldFlds
return: string[] Array of SQL Commands

Functions that are not part of a class:

lens_ParseTest()   X-Ref
Test script for parser


ctype_alnum($text)   X-Ref
No description

lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')   X-Ref
No description