Bulk Inserts and the Performance Holy Grial (Part II)
Hi, Back to our topic ( see previous post ) about bulk inserts using PHP and Oracle OCI library, the first approach I'll explain today is as follows: Public method bulk_insert public function bulk_insert($common, $data) { try { $params = $this->prepareBulkInsertParams($common, $data); return $this->ociBulkInsert($params); } catch (Exception $e) { $this->logger->log(ERROR, $e->getMessage()); } } Neat, isn't it? At a first glance, a much clearer method is the result of a first refactor. Many of the code pieces have been extracted to a new method ( Extract method , Refactoring, K. Beck) alongside with new ones to give support to the PL/SQL batch insert syntax. Preparing the Parameters This method is just for extracting the incoming data and transform it into a more manageable array. private function prepareBulkInsertParams(array $common, array $data) : array { ext...