![]() |
insert_batch returning -1 when query fails - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: insert_batch returning -1 when query fails (/showthread.php?tid=66773) |
insert_batch returning -1 when query fails - sneakyimp - 11-30-2016 I'm trying to work with the query builder's insert_batch function. According to the documentation, it should return FALSE on failure. That is not the case. Try this controller method: PHP Code: public function barf() { Seems to me it should probably throw an exception and at the very least it should return false. RE: insert_batch returning -1 when query fails - sneakyimp - 11-30-2016 Note insert_batch will also return -1 if you attempt to insert a record with a duplicate primary key value. RE: insert_batch returning -1 when query fails - sneakyimp - 11-30-2016 Also, the documentation on update_batch is incorrect: http://www.codeigniter.com/userguide3/database/query_builder.html?highlight=update_batch#CI_DB_query_builder::set_update_batch It lists the third param as this: Code: $value (string) – Field value, if $set is a single field Code: /** RE: insert_batch returning -1 when query fails - Narf - 12-01-2016 Do you have to post this on 3 different places? RE: insert_batch returning -1 when query fails - sneakyimp - 12-02-2016 I really apologize. I was trying to implement something with it and was casting around for help. Kinda had my head up my rear. |