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

Commit e66876c

Browse files
committed
dumper: fix the last chunksize >0 and rows=0 #15
1 parent cd048b9 commit e66876c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/dumper.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ func dumpTable(log *xlog.Log, conn *Connection, args *Args, table string) {
110110
}
111111
}
112112
if chunkbytes > 0 {
113-
insertone := fmt.Sprintf("INSERT INTO `%s`(%s) VALUES\n%s", table, strings.Join(fields, ","), strings.Join(rows, ",\n"))
114-
inserts = append(inserts, insertone)
113+
if len(rows) > 0 {
114+
insertone := fmt.Sprintf("INSERT INTO `%s`(%s) VALUES\n%s", table, strings.Join(fields, ","), strings.Join(rows, ",\n"))
115+
inserts = append(inserts, insertone)
116+
}
115117

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

0 commit comments

Comments
 (0)