Skip to content

Commit

Permalink
Implement net_buffer_length functionality
Browse files Browse the repository at this point in the history
Check `dumpSettpings['net_buffer_length']` instead of `self::MAXLINESIZE` to determine when to create a new insert

Mimics behaviour of the mysqldump --net_buffer_length argument: http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_net_buffer_length
  • Loading branch information
Sean committed Oct 19, 2016
1 parent c225512 commit 9578b4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ Refer to the [wiki](https://github.com/ifsnop/mysqldump-php/wiki/full-example) f
- http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_comments
- **skip-dump-date**
- http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_dump-date
- **net_buffer_length**
- http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_net_buffer_length

The following options are now enabled by default, and there is no way to disable them since
they should always be used.
Expand Down
3 changes: 2 additions & 1 deletion src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function __construct(
'skip-comments' => false,
'skip-dump-date' => false,
'init_commands' => array(),
'net_buffer_length' => self::MAXLINESIZE,
/* deprecated */
'disable-foreign-keys-check' => true
);
Expand Down Expand Up @@ -840,7 +841,7 @@ private function listValues($tableName)
} else {
$lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")");
}
if (($lineSize > self::MAXLINESIZE) ||
if (($lineSize > $this->dumpSettings['net_buffer_length']) ||
!$this->dumpSettings['extended-insert']) {
$onlyOnce = true;
$lineSize = $this->compressManager->write(";" . PHP_EOL);
Expand Down

0 comments on commit 9578b4c

Please sign in to comment.