Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
dumper: fix the last chunksize >0 and rows=0 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
BohuTANG committed Mar 11, 2019
1 parent cd048b9 commit e66876c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ func dumpTable(log *xlog.Log, conn *Connection, args *Args, table string) {
}
}
if chunkbytes > 0 {
insertone := fmt.Sprintf("INSERT INTO `%s`(%s) VALUES\n%s", table, strings.Join(fields, ","), strings.Join(rows, ",\n"))
inserts = append(inserts, insertone)
if len(rows) > 0 {
insertone := fmt.Sprintf("INSERT INTO `%s`(%s) VALUES\n%s", table, strings.Join(fields, ","), strings.Join(rows, ",\n"))
inserts = append(inserts, insertone)
}

query := strings.Join(inserts, ";\n") + ";\n"
file := fmt.Sprintf("%s/%s.%s.%05d.sql", args.Outdir, args.Database, table, fileNo)
Expand Down

0 comments on commit e66876c

Please sign in to comment.