Skip to content

Commit 84922e8

Browse files
Merge pull request #220 from sebastianfeldmann
Add '--skip-extended-insert' option
2 parents d9f8600 + bee950b commit 84922e8

File tree

4 files changed

+73
-70
lines changed

4 files changed

+73
-70
lines changed

src/Backup/Source/Mysqldump.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ class Mysqldump extends SimulatorExecutable implements Simulator, Restorable
153153
private $compress;
154154

155155
/**
156-
* Use mysqldump with extended insert
157-
* -e
156+
* Use mysqldump without extended insert
157+
* --skip-extended-insert
158158
*
159159
* @var boolean
160160
*/
161-
private $extendedInsert;
161+
private $skipExtendedInsert;
162162

163163
/**
164164
* Dump blob fields as hex
@@ -211,25 +211,25 @@ public function setup(array $conf = [])
211211
{
212212
$this->setupSourceData($conf);
213213

214-
$this->pathToMysql = Util\Arr::getValue($conf, 'pathToMysql', '');
215-
$this->pathToMysqldump = Util\Arr::getValue($conf, 'pathToMysqldump', '');
216-
$this->pathToMysqlimport = Util\Arr::getValue($conf, 'pathToMysqlimport', '');
217-
$this->host = Util\Arr::getValue($conf, 'host', '');
218-
$this->port = Util\Arr::getValue($conf, 'port', 0);
219-
$this->protocol = Util\Arr::getValue($conf, 'protocol', '');
220-
$this->user = Util\Arr::getValue($conf, 'user', '');
221-
$this->password = Util\Arr::getValue($conf, 'password', '');
222-
$this->gtidPurged = Util\Arr::getValue($conf, 'gtidPurged', '');
223-
$this->hexBlob = Util\Str::toBoolean(Util\Arr::getValue($conf, 'hexBlob', ''), false);
224-
$this->quick = Util\Str::toBoolean(Util\Arr::getValue($conf, 'quick', ''), false);
225-
$this->lockTables = Util\Str::toBoolean(Util\Arr::getValue($conf, 'lockTables', ''), false);
226-
$this->singleTransaction = Util\Str::toBoolean(Util\Arr::getValue($conf, 'singleTransaction', ''), false);
227-
$this->compress = Util\Str::toBoolean(Util\Arr::getValue($conf, 'compress', ''), false);
228-
$this->extendedInsert = Util\Str::toBoolean(Util\Arr::getValue($conf, 'extendedInsert', ''), false);
229-
$this->noData = Util\Str::toBoolean(Util\Arr::getValue($conf, 'noData', ''), false);
230-
$this->filePerTable = Util\Str::toBoolean(Util\Arr::getValue($conf, 'filePerTable', ''), false);
231-
$this->routines = Util\Str::toBoolean(Util\Arr::getValue($conf, 'routines', ''), false);
232-
$this->skipTriggers = Util\Str::toBoolean(Util\Arr::getValue($conf, 'skipTriggers', ''), false);
214+
$this->pathToMysql = Util\Arr::getValue($conf, 'pathToMysql', '');
215+
$this->pathToMysqldump = Util\Arr::getValue($conf, 'pathToMysqldump', '');
216+
$this->pathToMysqlimport = Util\Arr::getValue($conf, 'pathToMysqlimport', '');
217+
$this->host = Util\Arr::getValue($conf, 'host', '');
218+
$this->port = Util\Arr::getValue($conf, 'port', 0);
219+
$this->protocol = Util\Arr::getValue($conf, 'protocol', '');
220+
$this->user = Util\Arr::getValue($conf, 'user', '');
221+
$this->password = Util\Arr::getValue($conf, 'password', '');
222+
$this->gtidPurged = Util\Arr::getValue($conf, 'gtidPurged', '');
223+
$this->hexBlob = Util\Str::toBoolean(Util\Arr::getValue($conf, 'hexBlob', ''), false);
224+
$this->quick = Util\Str::toBoolean(Util\Arr::getValue($conf, 'quick', ''), false);
225+
$this->lockTables = Util\Str::toBoolean(Util\Arr::getValue($conf, 'lockTables', ''), false);
226+
$this->singleTransaction = Util\Str::toBoolean(Util\Arr::getValue($conf, 'singleTransaction', ''), false);
227+
$this->compress = Util\Str::toBoolean(Util\Arr::getValue($conf, 'compress', ''), false);
228+
$this->skipExtendedInsert = Util\Str::toBoolean(Util\Arr::getValue($conf, 'skipExtendedInsert', ''), false);
229+
$this->noData = Util\Str::toBoolean(Util\Arr::getValue($conf, 'noData', ''), false);
230+
$this->filePerTable = Util\Str::toBoolean(Util\Arr::getValue($conf, 'filePerTable', ''), false);
231+
$this->routines = Util\Str::toBoolean(Util\Arr::getValue($conf, 'routines', ''), false);
232+
$this->skipTriggers = Util\Str::toBoolean(Util\Arr::getValue($conf, 'skipTriggers', ''), false);
233233

234234
// this doesn't fail, but it doesn't work, so throw an exception so the user understands
235235
if ($this->filePerTable && count($this->structureOnly)) {
@@ -332,7 +332,7 @@ protected function createExecutable(Target $target) : Executable
332332
->dumpBlobsHexadecimal($this->hexBlob)
333333
->addGTIDStatement($this->gtidPurged)
334334
->useCompression($this->compress)
335-
->useExtendedInsert($this->extendedInsert)
335+
->skipExtendedInsert($this->skipExtendedInsert)
336336
->dumpTables($this->tables)
337337
->singleTransaction($this->singleTransaction)
338338
->dumpDatabases($this->databases)

src/Cli/Executable/Mysqldump.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Mysqldump extends Abstraction implements Executable
129129
* Dump only table structures
130130
* --no-data
131131
*
132-
* @var boolean
132+
* @var bool
133133
*/
134134
private $noData = false;
135135

@@ -149,26 +149,26 @@ class Mysqldump extends Abstraction implements Executable
149149
private $filePerTable;
150150

151151
/**
152-
* Use mysqldump extended insert mode
153-
* -e, --extended-insert
152+
* Skip mysqldump extended insert mode
153+
* --skip-extended-insert
154154
*
155-
* @var boolean
155+
* @var bool
156156
*/
157-
private $extendedInsert = false;
157+
private $skipExtendedInsert = false;
158158

159159
/**
160160
* Dump blob fields as hex.
161161
* --hex-blob
162162
*
163-
* @var boolean
163+
* @var bool
164164
*/
165165
private $hexBlob = false;
166166

167167
/**
168168
* Dump routines.
169169
* --routines
170170
*
171-
* @var boolean
171+
* @var bool
172172
*/
173173
private $routines = false;
174174

@@ -195,7 +195,7 @@ class Mysqldump extends Abstraction implements Executable
195195
private $compression;
196196

197197
/**
198-
* Constructor.
198+
* Constructor
199199
*
200200
* @param string $path
201201
*/
@@ -206,7 +206,7 @@ public function __construct(string $path = '')
206206
}
207207

208208
/**
209-
* Set the mysql credentials.
209+
* Set the mysql credentials
210210
*
211211
* @param string $user
212212
* @param string $password
@@ -220,7 +220,7 @@ public function credentials(string $user = '', string $password = '') : Mysqldum
220220
}
221221

222222
/**
223-
* Set the mysql hostname.
223+
* Set the mysql hostname
224224
*
225225
* @param string $host
226226
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -232,7 +232,7 @@ public function useHost(string $host) : Mysqldump
232232
}
233233

234234
/**
235-
* Set the mysql port.
235+
* Set the mysql port
236236
*
237237
* @param int $port
238238
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -256,7 +256,7 @@ public function useProtocol(string $protocol) : Mysqldump
256256
}
257257

258258
/**
259-
* Use '-q' quick mode.
259+
* Use '-q' quick mode
260260
*
261261
* @param boolean $bool
262262
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -268,7 +268,7 @@ public function useQuickMode(bool $bool) : Mysqldump
268268
}
269269

270270
/**
271-
* Use '--lock-tables' option.
271+
* Use '--lock-tables' option
272272
*
273273
* @param bool $bool
274274
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -280,7 +280,7 @@ public function lockTables(bool $bool) : Mysqldump
280280
}
281281

282282
/**
283-
* Use '--single-transaction' option.
283+
* Use '--single-transaction' option
284284
*
285285
* @param bool $bool
286286
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -292,7 +292,7 @@ public function singleTransaction(bool $bool) : Mysqldump
292292
}
293293

294294
/**
295-
* Use '-C' compress mode.
295+
* Use '-C' compress mode
296296
*
297297
* @param bool $bool
298298
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -304,19 +304,19 @@ public function useCompression(bool $bool) : Mysqldump
304304
}
305305

306306
/**
307-
* Use '-e' extended insert mode.
307+
* Use '--skip-extended-insert' option
308308
*
309309
* @param bool $bool
310310
* @return \phpbu\App\Cli\Executable\Mysqldump
311311
*/
312-
public function useExtendedInsert(bool $bool) : Mysqldump
312+
public function skipExtendedInsert(bool $bool) : Mysqldump
313313
{
314-
$this->extendedInsert = $bool;
314+
$this->skipExtendedInsert = $bool;
315315
return $this;
316316
}
317317

318318
/**
319-
* Use '--hex-blob' to encode binary fields.
319+
* Use '--hex-blob' to encode binary fields
320320
*
321321
* @param bool $bool
322322
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -328,7 +328,7 @@ public function dumpBlobsHexadecimal(bool $bool) : Mysqldump
328328
}
329329

330330
/**
331-
* Set tables to dump.
331+
* Set tables to dump
332332
*
333333
* @param array $tables
334334
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -340,7 +340,7 @@ public function dumpTables(array $tables) : Mysqldump
340340
}
341341

342342
/**
343-
* Set databases to dump.
343+
* Set databases to dump
344344
*
345345
* @param array $databases
346346
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -352,7 +352,7 @@ public function dumpDatabases(array $databases) : Mysqldump
352352
}
353353

354354
/**
355-
* Set tables to ignore.
355+
* Set tables to ignore
356356
*
357357
* @param array $tables
358358
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -364,7 +364,7 @@ public function ignoreTables(array $tables) : Mysqldump
364364
}
365365

366366
/**
367-
* Set tables where only table structure should be dumped.
367+
* Set tables where only table structure should be dumped
368368
*
369369
* @param array $tables
370370
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -376,7 +376,7 @@ public function dumpStructureOnly(array $tables) : Mysqldump
376376
}
377377

378378
/**
379-
* Dump no table data at all.
379+
* Dump no table data at all
380380
*
381381
* @param bool $bool
382382
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -388,7 +388,7 @@ public function dumpNoData(bool $bool) : Mysqldump
388388
}
389389

390390
/**
391-
* Add a general transaction ID statement to the dump file.
391+
* Add a general transaction ID statement to the dump file
392392
*
393393
* @param string $purge
394394
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -400,7 +400,7 @@ public function addGTIDStatement(string $purge)
400400
}
401401

402402
/**
403-
* Produce table separated data files.
403+
* Produce table separated data files
404404
*
405405
* @param bool $bool
406406
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -412,7 +412,7 @@ public function produceFilePerTable(bool $bool) : Mysqldump
412412
}
413413

414414
/**
415-
* Dump procedures and functions.
415+
* Dump procedures and functions
416416
*
417417
* @param bool $bool
418418
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -424,7 +424,7 @@ public function dumpRoutines(bool $bool) : Mysqldump
424424
}
425425

426426
/**
427-
* Skip triggers.
427+
* Skip triggers
428428
*
429429
* @param bool $bool
430430
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -436,7 +436,7 @@ public function skipTriggers(bool $bool) : Mysqldump
436436
}
437437

438438
/**
439-
* Pipe compressor.
439+
* Pipe compressor
440440
*
441441
* @param \phpbu\App\Backup\Target\Compression $compression
442442
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -448,7 +448,7 @@ public function compressOutput(Compression $compression) : Mysqldump
448448
}
449449

450450
/**
451-
* Set the dump target path.
451+
* Set the dump target path
452452
*
453453
* @param string $path
454454
* @return \phpbu\App\Cli\Executable\Mysqldump
@@ -460,7 +460,7 @@ public function dumpTo(string $path) : Mysqldump
460460
}
461461

462462
/**
463-
* Mysqldump CommandLine generator.
463+
* Mysqldump CommandLine generator
464464
*
465465
* @return \SebastianFeldmann\Cli\CommandLine
466466
* @throws \phpbu\App\Exception
@@ -480,7 +480,7 @@ protected function createCommandLine() : CommandLine
480480
$cmd->addOptionIfNotEmpty('--single-transaction', $this->singleTransaction, false);
481481
$cmd->addOptionIfNotEmpty('-q', $this->quick, false);
482482
$cmd->addOptionIfNotEmpty('-C', $this->compress, false);
483-
$cmd->addOptionIfNotEmpty('-e', $this->extendedInsert, false);
483+
$cmd->addOptionIfNotEmpty('--skip-extended-insert', $this->skipExtendedInsert, false);
484484
$cmd->addOptionIfNotEmpty('--hex-blob', $this->hexBlob, false);
485485
$cmd->addOptionIfNotEmpty('--set-gtid-purged', $this->gtidPurged);
486486
$cmd->addOptionIfNotEmpty('--routines', $this->routines, false);
@@ -514,7 +514,7 @@ protected function createCommandLine() : CommandLine
514514
}
515515

516516
/**
517-
* Configure source data (tables, databases).
517+
* Configure source data (tables, databases)
518518
*
519519
* @param \SebastianFeldmann\Cli\Command\Executable $cmd
520520
* @throws \phpbu\App\Exception
@@ -529,7 +529,7 @@ private function configureSourceData(Cmd $cmd)
529529
}
530530

531531
/**
532-
* Configure source tables.
532+
* Configure source tables
533533
*
534534
* @param \SebastianFeldmann\Cli\Command\Executable $cmd
535535
* @throws \phpbu\App\Exception
@@ -544,7 +544,7 @@ private function configureSourceTables(Cmd $cmd)
544544
}
545545

546546
/**
547-
* Configure source databases.
547+
* Configure source databases
548548
*
549549
* @param \SebastianFeldmann\Cli\Command\Executable $cmd
550550
*/
@@ -580,7 +580,7 @@ private function configureIgnoredTables(Cmd $cmd)
580580
}
581581

582582
/**
583-
* Add compressor pipe if set.
583+
* Add compressor pipe if set
584584
*
585585
* @param \SebastianFeldmann\Cli\CommandLine $process
586586
*/
@@ -595,7 +595,7 @@ private function configureCompression(CommandLine $process)
595595
}
596596

597597
/**
598-
* Configure output redirect.
598+
* Configure output redirect
599599
*
600600
* @param \SebastianFeldmann\Cli\CommandLine $process
601601
*/

0 commit comments

Comments
 (0)