2017 © Pedro Peláez
 

library bulkdbinserter

Create a database writer using PDO to support multiple row insertion

image

sdragnev/bulkdbinserter

Create a database writer using PDO to support multiple row insertion

  • Saturday, July 21, 2018
  • by sdragnev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

BulkDBInserter

Helper class that can buffer multiple PDO writes into one query., (*1)

Example usage, inserting 1200 records in the "accounts" table given an existing PDO connection object $pdo, 500 (default) records at a time:, (*2)

// Inserts 1200 records in 3 queries (500 + 500 + 200)
$writer = new BulkInserter($pdo, "accounts", ["id", "name"]);
// $writer->setBatch(600); // optionally set the buffer size to a different number

for ($i = 0; $i < 1200; $i++) {
    $writer->write([$i, "John $i"]);
}

$writer->flush(true);   // flushes the remaining buffer

The Versions

21/07 2018

dev-master

9999999-dev https://github.com/sdragnev/BulkDBInserter

Create a database writer using PDO to support multiple row insertion

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.5.0
  • ext-pdo *

 

database php pdo

21/07 2018

v1.0.0

1.0.0.0 https://github.com/sdragnev/BulkDBInserter

Create a database writer using PDO to support multiple row insertion

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=5.5.0
  • ext-pdo *

 

database php pdo