@@ -366,6 +366,7 @@ def dbTableValues(self, tableValues):
366366 replication = None
367367 rtable = None
368368 dumpFP = None
369+ appendToFile = False
369370
370371 if tableValues is None :
371372 return
@@ -388,7 +389,8 @@ def dbTableValues(self, tableValues):
388389 os .makedirs (dumpDbPath , 0755 )
389390
390391 dumpFileName = "%s%s%s.%s" % (dumpDbPath , os .sep , unsafeSQLIdentificatorNaming (table ), conf .dumpFormat .lower ())
391- dumpFP = openFile (dumpFileName , "wb" )
392+ appendToFile = os .path .isfile (dumpFileName ) and any ((conf .limitStart , conf .limitStop ))
393+ dumpFP = openFile (dumpFileName , "wb" if not appendToFile else "ab" )
392394
393395 count = int (tableValues ["__infos__" ]["count" ])
394396 separator = str ()
@@ -466,22 +468,23 @@ def dbTableValues(self, tableValues):
466468
467469 self ._write ("| %s%s" % (column , blank ), newline = False )
468470
469- if conf .dumpFormat == DUMP_FORMAT .CSV :
470- if field == fields :
471- dataToDumpFile (dumpFP , "%s" % safeCSValue (column ))
472- else :
473- dataToDumpFile (dumpFP , "%s%s" % (safeCSValue (column ), conf .csvDel ))
474- elif conf .dumpFormat == DUMP_FORMAT .HTML :
475- entryNode = documentNode .createElement ("td" )
476- rowNode .appendChild (entryNode )
477- entryNode .appendChild (documentNode .createTextNode (column ))
471+ if not appendToFile :
472+ if conf .dumpFormat == DUMP_FORMAT .CSV :
473+ if field == fields :
474+ dataToDumpFile (dumpFP , "%s" % safeCSValue (column ))
475+ else :
476+ dataToDumpFile (dumpFP , "%s%s" % (safeCSValue (column ), conf .csvDel ))
477+ elif conf .dumpFormat == DUMP_FORMAT .HTML :
478+ entryNode = documentNode .createElement ("td" )
479+ rowNode .appendChild (entryNode )
480+ entryNode .appendChild (documentNode .createTextNode (column ))
478481
479482 field += 1
480483
481484 self ._write ("|\n %s" % separator )
482485
483486 if conf .dumpFormat == DUMP_FORMAT .CSV :
484- dataToDumpFile (dumpFP , "\n " )
487+ dataToDumpFile (dumpFP , "\n " if not appendToFile else "" )
485488
486489 elif conf .dumpFormat == DUMP_FORMAT .SQLITE :
487490 rtable .beginTransaction ()
0 commit comments