typeXL : 'TEXT'; case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle case 'C2': return 'NVARCHAR'; case 'X2': return 'NTEXT'; case 'B': return 'IMAGE'; case 'D': return 'DATETIME'; case 'T': return 'DATETIME'; case 'L': return 'BIT'; case 'R': case 'I': return 'INT'; case 'I1': return 'TINYINT'; case 'I2': return 'SMALLINT'; case 'I4': return 'INT'; case 'I8': return 'BIGINT'; case 'F': return 'REAL'; case 'N': return 'NUMERIC'; default: return $meta; } } function DropColumnSQL($tabname, $flds) { $tabname = $this->TableName ($tabname); if (!is_array($flds)) $flds = explode(',',$flds); $f = array(); $s = 'ALTER TABLE ' . $tabname; foreach($flds as $v) { $f[] = "\n$this->dropCol ".$this->NameQuote($v); } $s .= implode(', ',$f); $sql[] = $s; return $sql; } function AddColumnSQL($tabname, $flds) { $tabname = $this->TableName ($tabname); $f = array(); list($lines,$pkey) = $this->_GenFields($flds); $s = "ALTER TABLE $tabname $this->addCol"; foreach($lines as $v) { $f[] = "\n $v"; } $s .= implode(', ',$f); $sql[] = $s; return $sql; } function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) { $suffix = ''; if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; if ($fautoinc) $suffix .= ' IDENTITY(1,1)'; if ($fnotnull) $suffix .= ' NOT NULL'; else if ($suffix == '') $suffix .= ' NULL'; if ($fconstraint) $suffix .= ' '.$fconstraint; return $suffix; } function _IndexSQL($idxname, $tabname, $flds, $idxoptions) { $sql = array(); if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); if ( isset($idxoptions['DROP']) ) return $sql; } if ( empty ($flds) ) { return $sql; } $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; $clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : ''; if ( is_array($flds) ) $flds = implode(', ',$flds); $s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')'; if ( isset($idxoptions[$this->upperName]) ) $s .= $idxoptions[$this->upperName]; $sql[] = $s; return $sql; } function _GetSize($ftype, $ty, $fsize, $fprec) { switch ($ftype) { case 'INT': case 'SMALLINT': case 'TINYINT': case 'BIGINT': return $ftype; } if ($ty == 'T') return $ftype; return parent::_GetSize($ftype, $ty, $fsize, $fprec); } } ?>