debug) ADOConnection::outp("AlterColumnSQL not supported"); return array(); } function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') { if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); return array(); } function ChangeTableSQL($tablename, $flds, $tableoptions = false) { /** Allow basic table changes to DB2 databases DB2 will fatally reject changes to non character columns */ $validTypes = array("CHAR","VARC"); $invalidTypes = array("BIGI","BLOB","CLOB","DATE", "DECI","DOUB", "INTE", "REAL","SMAL", "TIME"); // check table exists $cols = $this->MetaColumns($tablename); if ( empty($cols)) { return $this->CreateTableSQL($tablename, $flds, $tableoptions); } // already exists, alter table instead list($lines,$pkey) = $this->_GenFields($flds); $alter = 'ALTER TABLE ' . $this->TableName($tablename); $sql = array(); foreach ( $lines as $id => $v ) { if ( isset($cols[$id]) && is_object($cols[$id]) ) { /** If the first field of $v is the fieldname, and the second is the field type/size, we assume its an attempt to modify the column size, so check that it is allowed $v can have an indeterminate number of blanks between the fields, so account for that too */ $vargs = explode(' ' , $v); // assume that $vargs[0] is the field name. $i=0; // Find the next non-blank value; for ($i=1;$ialterCol . ' ' . $v; } else { $sql[] = $alter . $this->addCol . ' ' . $v; } } return $sql; } }