@@ -324,12 +324,11 @@ public function fetchAll(string $sql): array
324324 /**
325325 * Get the parameters array for prepared insert statement
326326 *
327+ * @param array $params Parameters array to be filled
327328 * @param array $row Row to be inserted into DB
328- * @return array
329329 */
330- protected function getInsertParameters (array $ row ): array
330+ protected function getInsertParameters (array & $ params , array $ row ): void
331331 {
332- $ params = [];
333332 foreach ($ row as $ value ) {
334333 if ($ value instanceof Literal) {
335334 continue ;
@@ -343,8 +342,6 @@ protected function getInsertParameters(array $row): array
343342 $ params [] = $ value ;
344343 }
345344 }
346-
347- return $ params ;
348345 }
349346
350347 /**
@@ -374,7 +371,8 @@ public function insert(Table $table, array $row): void
374371 foreach ($ row as $ value ) {
375372 $ values [] = $ value instanceof Literal ? (string )$ value : '? ' ;
376373 }
377- $ params = $ this ->getInsertParameters ($ row );
374+ $ params = [];
375+ $ this ->getInsertParameters ($ params , $ row );
378376 $ sql .= implode (', ' , $ values ) . ') ' ;
379377 $ stmt = $ this ->getConnection ()->prepare ($ sql );
380378 $ stmt ->execute ($ params );
@@ -445,10 +443,10 @@ public function bulkinsert(Table $table, array $rows): void
445443 }
446444 $ sql .= implode (', ' , $ queries );
447445 $ stmt = $ this ->getConnection ()->prepare ($ sql );
448- $ params = [];
449446
447+ $ params = [];
450448 foreach ($ rows as $ row ) {
451- $ params = array_merge ( $ params , $ this ->getInsertParameters ($ row) );
449+ $ this ->getInsertParameters ($ params , $ row );
452450 }
453451
454452 $ stmt ->execute ($ params );
0 commit comments