diff --git a/core/MY_Model.php b/core/MY_Model.php index 05add98..a22c036 100644 --- a/core/MY_Model.php +++ b/core/MY_Model.php @@ -243,6 +243,19 @@ public function insert_many($data, $skip_validation = FALSE) return $ids; } + /** + * Insert rows in batch into the table instead of doing one by one. + * This method is faster than "insert_many", but beware of passing unvalidated data, since this + * method does not deploy class validation nor db trigger execution either. + * Returns true on success or false otherwise. + */ + public function insert_batch($data) + { + $result = $this->_database->insert_batch($this->_table, $data); + + return $result; + } + /** * Updated a record based on the primary value. */