public function getColumnQuery() {
        // prepare column types
        $type_val = $this->getTypeVal();
        // build query
        $query = $this->db->quotekey($this->name).' '.$type_val.' '.
            $this->getNullable();
        // unify default for booleans
        if (preg_match('/bool/i', $type_val) && $this->default!==null)
            $this->default = (int) $this->default;
        // default value
        if ($this->default !== false) {
            $def_cmds = array(
                'sqlite2?|mysql|pgsql' => 'DEFAULT',
                'mssql|sybase|dblib|odbc|sqlsrv' => 'constraint DF_'.$this->table->name.'_'.$this->name.' DEFAULT',
                'ibm' => 'WITH DEFAULT',
            );
            $def_cmd = $this->findQuery($def_cmds).' '.$this->getDefault();
            $query .= ' '.$def_cmd;
        }
        if (!empty($this->after) && $this->table instanceof TableModifier) {
            // `after` feature only works for mysql
            if (preg_match('/mysql/', $this->db->driver())) {
                $after_cmd = 'AFTER '.$this->db->quotekey($this->after);
                $query .= ' '.$after_cmd;
            }
        }
        return $query;
    }
public function getColumnQuery() {
        // prepare column types
        $type_val = $this->getTypeVal();
        // build query
        $query = $this->db->quotekey($this->name).' '.$type_val.' '.
            $this->getNullable();
        // unify default for booleans
        if (preg_match('/bool/i', $type_val) && $this->default!==null)
            $this->default = (int) $this->default;
        // default value
        if ($this->default !== false) {
            $def_cmds = array(
                'sqlite2?|mysql|pgsql' => 'DEFAULT',
                'mssql|sybase|dblib|odbc|sqlsrv' => 'constraint DF_'.$this->table->name.'_'.$this->name.' DEFAULT',
                'ibm' => 'WITH DEFAULT',
            );
            $def_cmd = $this->findQuery($def_cmds).' '.$this->getDefault();
            $query .= ' '.$def_cmd;
        }
        if (!empty($this->after) && $this->table instanceof TableModifier) {
            // `after` feature only works for mysql
            if (preg_match('/mysql/', $this->db->driver())) {
                $after_cmd = 'AFTER '.$this->db->quotekey($this->after);
                $query .= ' '.$after_cmd;
            }
        }
        return $query;
    }
public function getColumnQuery ( ) { // prepare column types $ type_val = $ this -> getTypeVal ( ) ; // build query $ query = $ this -> db -> quotekey ( $ this -> name ) . ' ' . $ type_val . ' ' . $ this -> getNullable ( ) ; // unify default for booleans if ( preg_match ( '/bool/i' , $ type_val ) && $ this -> default !== null ) $ this -> default = ( int ) $ this -> default ; // default value if ( $ this -> default !== false ) { $ def_cmds = array ( 'sqlite2?|mysql|pgsql' => 'DEFAULT' , 'mssql|sybase|dblib|odbc|sqlsrv' => 'constraint DF_' . $ this -> table -> name . '_' . $ this -> name . ' DEFAULT' , 'ibm' => 'WITH DEFAULT' , ) ; $ def_cmd = $ this -> findQuery ( $ def_cmds ) . ' ' . $ this -> getDefault ( ) ; $ query .= ' ' . $ def_cmd ; } if ( ! empty ( $ this -> after ) && $ this -> table instanceof TableModifier ) { // `after` feature only works for mysql if ( preg_match ( '/mysql/' , $ this -> db -> driver ( ) ) ) { $ after_cmd = 'AFTER ' . $ this -> db -> quotekey ( $ this -> after ) ; $ query .= ' ' . $ after_cmd ; } } return $ query ; }
generate SQL column definition query
@return bool|string
generate SQL column definition query