13 if (!defined(
'ADODB_DIR'))
die();
23 case 'C':
return 'VARCHAR';
24 case 'XL':
return 'CLOB';
25 case 'X':
return 'VARCHAR(3600)';
27 case 'C2':
return 'VARCHAR';
28 case 'X2':
return 'VARCHAR(3600)';
30 case 'B':
return 'BLOB';
32 case 'D':
return 'DATE';
34 case 'T':
return 'TIMESTAMP';
36 case 'L':
return 'SMALLINT';
37 case 'I':
return 'INTEGER';
38 case 'I1':
return 'SMALLINT';
39 case 'I2':
return 'SMALLINT';
40 case 'I4':
return 'INTEGER';
41 case 'I8':
return 'BIGINT';
43 case 'F':
return 'DOUBLE';
44 case 'N':
return 'DECIMAL';
51 function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
54 if ($fautoinc)
return ' GENERATED ALWAYS AS IDENTITY'; # as identity start with
55 if (strlen($fdefault)) $suffix .=
" DEFAULT $fdefault";
56 if ($fnotnull) $suffix .=
' NOT NULL';
57 if ($fconstraint) $suffix .=
' '.$fconstraint;
63 if ($this->
debug) ADOConnection::outp(
"AlterColumnSQL not supported");
68 function DropColumnSQL($tabname, $flds, $tableflds=
'', $tableoptions=
'')
70 if ($this->
debug) ADOConnection::outp(
"DropColumnSQL not supported");
84 $validTypes = array(
"CHAR",
"VARC");
85 $invalidTypes = array(
"BIGI",
"BLOB",
"CLOB",
"DATE",
"DECI",
"DOUB",
"INTE",
"REAL",
"SMAL",
"TIME");
94 $alter =
'ALTER TABLE ' . $this->
TableName($tablename);
97 foreach ( $lines as $id => $v ) {
98 if ( isset($cols[$id]) && is_object($cols[$id]) ) {
106 $vargs = explode(
' ' , $v);
110 for ($i=1;$i<
sizeof($vargs);$i++)
111 if ($vargs[$i] !=
'')
116 if (in_array(substr($vargs[$i],0,4),$invalidTypes))
119 if (in_array(substr($vargs[$i],0,4),$validTypes)) {
120 array_splice($vargs,$i,0,array(
'SET',
'DATA',
'TYPE'));
125 if (in_array(
'NOT',$vargs) && in_array(
'NULL',$vargs)) {
126 for ($i=1;$i<
sizeof($vargs);$i++)
127 if ($vargs[$i] ==
'NOT')
129 array_splice($vargs,$i,2,
'');
131 $v = implode(
' ',$vargs);
132 $sql[] = $alter . $this->alterCol .
' ' . $v;
134 $sql[] = $alter . $this->addCol .
' ' . $v;
_GenFields($flds, $widespacing=false)
MetaColumns($tab, $upper=true, $schema=false)
AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
ChangeTableSQL($tablename, $flds, $tableoptions=false)
CreateTableSQL($tabname, $flds, $tableoptions=array())
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)
_CreateSuffix($fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned)