Source for file datadict-mysql.inc.php
Documentation is available at datadict-mysql.inc.php
V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Set tabs to 4 for best viewing.
var $dropTable =
'DROP TABLE IF EXISTS %s'; // requires mysql 3.22 or later
var $renameColumn =
'ALTER TABLE %s CHANGE COLUMN %s %s %s'; // needs column-definition!
function MetaType($t,$len=-
1,$fieldobj=
false)
$len =
$fieldobj->max_length;
$is_serial =
is_object($fieldobj) &&
$fieldobj->primary_key &&
$fieldobj->auto_increment;
$len = -
1; // mysql max_length is not accurate
if ($len <=
$this->blobSize) return 'C';
// php_mysql extension always returns 'blob' even if 'text'
// so we have to check whether binary...
return !empty($fieldobj->binary) ?
'B' :
'X';
case 'TIMESTAMP':
return 'T';
case 'INTEGER':
return $is_serial ?
'R' :
'I';
case 'TINYINT':
return $is_serial ?
'R' :
'I1';
case 'SMALLINT':
return $is_serial ?
'R' :
'I2';
case 'MEDIUMINT':
return $is_serial ?
'R' :
'I4';
case 'BIGINT':
return $is_serial ?
'R' :
'I8';
case 'C':
return 'VARCHAR';
case 'XL':
return 'LONGTEXT';
case 'C2':
return 'VARCHAR';
case 'X2':
return 'LONGTEXT';
case 'B':
return 'LONGBLOB';
case 'T':
return 'DATETIME';
case 'L':
return 'TINYINT';
case 'I':
return 'INTEGER';
case 'I1':
return 'TINYINT';
case 'I2':
return 'SMALLINT';
case 'I8':
return 'BIGINT';
case 'F':
return 'DOUBLE';
case 'N':
return 'NUMERIC';
// return string must begin with space
function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
if ($funsigned) $suffix .=
' UNSIGNED';
if ($fnotnull) $suffix .=
' NOT NULL';
if (strlen($fdefault)) $suffix .=
" DEFAULT $fdefault";
if ($fautoinc) $suffix .=
' AUTO_INCREMENT';
if ($fconstraint) $suffix .=
' '.
$fconstraint;
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]
col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
[PRIMARY KEY] [reference_definition]
or PRIMARY KEY (index_col_name,...)
or KEY [index_name] (index_col_name,...)
or INDEX [index_name] (index_col_name,...)
or UNIQUE [INDEX] [index_name] (index_col_name,...)
or FULLTEXT [INDEX] [index_name] (index_col_name,...)
or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
CREATE [UNIQUE|FULLTEXT] INDEX index_name
ON tbl_name (col_name[(length)],... )
function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
if ( isset
($idxoptions['REPLACE']) || isset
($idxoptions['DROP']) ) {
if ( isset
($idxoptions['DROP']) )
if (isset
($idxoptions['FULLTEXT'])) {
} elseif (isset
($idxoptions['UNIQUE'])) {
else $s =
'CREATE' .
$unique .
' INDEX ' .
$idxname .
' ON ' .
$tabname;
$s .=
' (' .
$flds .
')';
if ( isset
($idxoptions[$this->upperName]) )
$s .=
$idxoptions[$this->upperName];
Documentation generated on Sun, 09 Mar 2008 23:51:31 -0300 by phpDocumentor 1.4.0