![]() |
help, add_column can't work. DB: sql express 2008 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: help, add_column can't work. DB: sql express 2008 (/showthread.php?tid=57829) |
help, add_column can't work. DB: sql express 2008 - El Forum - 04-15-2013 [eluser]Unknown[/eluser] HI I find a problem,If background db is sql express 2008, the add_column will thread a error. I don't sure that It's a bug.who can help me .thanks a lot. Error Number: 42000 [Microsoft][SQL Server Native Client 10.0][SQL Server]column 'Array' must include datatype. ALTER TABLE users ADD Array NOT NULL Filename: C:\\website\\apache\\htdocs\\CodeIgniter_2\\system\\database\\DB_driver.php Line Number: 330 controller as follows: public function index() { $this->output->enable_profiler(); $this->load->database(); $this->load->dbforge(); $fields = array( 'user_id' => array( 'type' => 'INT' ), 'username' => array( 'type' => 'TEXT', ) ); $this->dbforge->add_field($fields); $this->dbforge->add_key('user_id', TRUE); $this->dbforge->create_table('users'); $f = array( 'bio' => array('type' => 'TEXT') ); $this->dbforge->add_column('users', $f); $this->dbforge->drop_column('users', 'bio'); $f = array( 'status' => array('type' => 'BOOLEAN') ); $this->dbforge->add_column('users', $f); } help, add_column can't work. DB: sql express 2008 - El Forum - 04-15-2013 [eluser]TheFuzzy0ne[/eluser] I'm sorry, but that appears to be a bug. The _alter_table() method expects the third parameter to be a string, but an array is being passed. I think it should be expecting an array, but doesn't seem to have been updated like the other drivers. I would like to offer you a workaround, but I know nothing about MSSQL, and the required fix for your problem is not as straightforward as I'd have hoped. Sorry... ![]() |