protected function getSqlFields(array $fields)
    {
        $sql = array();
        foreach ($fields as $name => $info) {

            if (strpos($info['type'], 'text') !== false || $info['type'] === 'blob') {
                unset($info['default']);
            }

            $string = "{$info['type']}";

            if (isset($info['length'])) {
                $string .= "({$info['length']})";
            }

            if (!empty($info['not_null'])) {
                $string .= " NOT NULL";
            }

            if (isset($info['default'])) {
                $string .= " DEFAULT '{$info['default']}'";
            }

            if (!empty($info['primary'])) {
                $string .= " PRIMARY KEY";
            }

            if (!empty($info['auto_increment'])) {
                $string .= " /*!40101 AUTO_INCREMENT */"; // SQLite will ignore this comment
            }

            $sql[] = $name . ' ' . trim($string);
        }

        return implode(',', $sql);
    }
protected function getSqlFields(array $fields)
    {
        $sql = array();
        foreach ($fields as $name => $info) {

            if (strpos($info['type'], 'text') !== false || $info['type'] === 'blob') {
                unset($info['default']);
            }

            $string = "{$info['type']}";

            if (isset($info['length'])) {
                $string .= "({$info['length']})";
            }

            if (!empty($info['not_null'])) {
                $string .= " NOT NULL";
            }

            if (isset($info['default'])) {
                $string .= " DEFAULT '{$info['default']}'";
            }

            if (!empty($info['primary'])) {
                $string .= " PRIMARY KEY";
            }

            if (!empty($info['auto_increment'])) {
                $string .= " /*!40101 AUTO_INCREMENT */"; // SQLite will ignore this comment
            }

            $sql[] = $name . ' ' . trim($string);
        }

        return implode(',', $sql);
    }
protected function getSqlFields ( array $ fields ) { $ sql = array ( ) ; foreach ( $ fields as $ name => $ info ) { if ( strpos ( $ info [ 'type' ] , 'text' ) !== false || $ info [ 'type' ] === 'blob' ) { unset ( $ info [ 'default' ] ) ; } $ string = "{$info['type']}" ; if ( isset ( $ info [ 'length' ] ) ) { $ string .= "({$info['length']})" ; } if ( ! empty ( $ info [ 'not_null' ] ) ) { $ string .= " NOT NULL" ; } if ( isset ( $ info [ 'default' ] ) ) { $ string .= " DEFAULT '{$info['default']}'" ; } if ( ! empty ( $ info [ 'primary' ] ) ) { $ string .= " PRIMARY KEY" ; } if ( ! empty ( $ info [ 'auto_increment' ] ) ) { $ string .= " /*!40101 AUTO_INCREMENT */" ; // SQLite will ignore this comment } $ sql [ ] = $ name . ' ' . trim ( $ string ) ; } return implode ( ',' , $ sql ) ; }
Returns a SQL that describes table fields.
Used to create tables
@param array $fields
@return string
Returns a SQL that describes table fields . Used to create tables