Onethink cannot create a new editor type field under MySQL

Source: Internet
Author: User

Onethink cannot create a new editor type field under MySQL

Clone the latest code is installed, inherits the base document, adds the Detaildesc field to the editor type, and does not have a new table. And the SQL statement is wrong

The main reason is that mysql5.x is not allowed to have a default value for a field of type Blob/text, and the temporary fix code is admin/controller/attributecontroller.class.php

protected function Updatefield ($field) {        //Check whether the table exists        $table _exist = $this->checktableexist ($field [' Model_ ID ']);        Get the original field name        $last _field = $this->getfieldbyid ($field [' id '], ' name ');        /* Get default value        1,  mysql5.x is not allowed Blob/text Type field has default value of        2,  because MySQL is in ' strict Mode ' strict mode, if changed to non-strict mode, the above statement can be executed successfully         3,  mysql5.x under Windows is the default to ' strict mode ', when executing the above statement, will give you an error or warning message        */        if (Strpos (Strtolower ($field [' field ']), ' text ') >=0) {            $default = ';        } else{            $default = $field [' Value ']!= '? "DEFAULT". $field [' value ']. "'": ';        }         $sql = <<<sql            ALTER TABLE ' {$this->table_name} ' change COLUMN ' {$last _field} ' {$field [' name ']} '  {$field ["field"]} {$default} COMMENT ' {$field ["title"]} '; SQL;        $res = M ()->execute ($sql);        return $res!== false;    }



Onethink cannot create a new editor Type field under MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.