42 if (!defined(
'ADODB_DIR'))
die();
49 var
$typeX =
'TEXT'; ## Alternatively,
set it to VARCHAR(4000)
59 $len = $fieldobj->max_length;
62 $_typeConversion = array(
95 return $_typeConversion($t);
101 $DATE_TYPE =
'DATETIME';
103 switch(strtoupper($meta)) {
105 case 'C':
return 'VARCHAR';
106 case 'XL':
return (isset($this)) ? $this->typeXL :
'TEXT';
107 case 'X':
return (isset($this)) ? $this->typeX :
'TEXT'; ## could be varchar(8000), but we want compat with oracle
108 case 'C2':
return 'NVARCHAR';
109 case 'X2':
return 'NTEXT';
111 case 'B':
return 'IMAGE';
113 case 'D':
return $DATE_TYPE;
114 case 'T':
return 'TIME';
115 case 'L':
return 'BIT';
118 case 'I':
return 'INT';
119 case 'I1':
return 'TINYINT';
120 case 'I2':
return 'SMALLINT';
121 case 'I4':
return 'INT';
122 case 'I8':
return 'BIGINT';
124 case 'F':
return 'REAL';
125 case 'N':
return 'NUMERIC';
127 print
"RETURN $meta";
137 list($lines,$pkey) = $this->
_GenFields($flds);
138 $s =
"ALTER TABLE $tabname $this->addCol";
139 foreach($lines as $v) {
142 $s .= implode(
', ',$f);
174 if (!is_array($flds))
175 $flds = explode(
',',$flds);
177 $s =
'ALTER TABLE ' . $tabname .
' DROP COLUMN ';
178 foreach($flds as $v) {
182 $s .= implode(
', ',$f);
188 function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
191 if (strlen($fdefault)) $suffix .=
" DEFAULT $fdefault";
192 if ($fautoinc) $suffix .=
' IDENTITY(1,1)';
193 if ($fnotnull) $suffix .=
' NOT NULL';
194 else if ($suffix ==
'') $suffix .=
' NULL';
195 if ($fconstraint) $suffix .=
' '.$fconstraint;
271 function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
275 if ( isset($idxoptions[
'REPLACE']) || isset($idxoptions[
'DROP']) ) {
276 $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
277 if ( isset($idxoptions[
'DROP']) )
281 if ( empty ($flds) ) {
285 $unique = isset($idxoptions[
'UNIQUE']) ?
' UNIQUE' :
'';
286 $clustered = isset($idxoptions[
'CLUSTERED']) ?
' CLUSTERED' :
'';
288 if ( is_array($flds) )
289 $flds = implode(
', ',$flds);
290 $s =
'CREATE' . $unique . $clustered .
' INDEX ' . $idxname .
' ON ' . $tabname .
' (' . $flds .
')';
292 if ( isset($idxoptions[$this->upperName]) )
293 $s .= $idxoptions[$this->upperName];
311 if ($ty ==
'T')
return $ftype;
312 return parent::_GetSize($ftype, $ty, $fsize, $fprec);
MetaType($t, $len=-1, $fieldobj=false)
_GenFields($flds, $widespacing=false)
_GetSize($ftype, $ty, $fsize, $fprec)
AddColumnSQL($tabname, $flds)
_IndexSQL($idxname, $tabname, $flds, $idxoptions)
DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
_CreateSuffix($fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned)
NameQuote($name=NULL, $allowBrackets=false)