Skip to content

Commit 1bdf5bd

Browse files
badoetjulienschmidt
authored andcommitted
added the multiStatements param to the dsn parameter
1 parent 5ce0b98 commit 1bdf5bd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

dsn.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Config struct {
4646
ClientFoundRows bool // Return number of matching rows instead of rows changed
4747
ColumnsWithAlias bool // Prepend table alias to column names
4848
InterpolateParams bool // Interpolate placeholders into query string
49+
MultiStatements bool // Allow multiple statements in one query
4950
ParseTime bool // Parse time values to time.Time
5051
Strict bool // Return warnings as errors
5152
}
@@ -235,6 +236,14 @@ func parseDSNParams(cfg *Config, params string) (err error) {
235236
return
236237
}
237238

239+
// multiple statements in one query
240+
case "multiStatements":
241+
var isBool bool
242+
cfg.MultiStatements, isBool = readBool(value)
243+
if !isBool {
244+
return errors.New("invalid bool value: " + value)
245+
}
246+
238247
// time.Time parsing
239248
case "parseTime":
240249
var isBool bool

packets.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
236236
clientFlags |= clientSSL
237237
}
238238

239+
if mc.cfg.MultiStatements {
240+
clientFlags |= clientMultiStatements
241+
}
242+
239243
// User Password
240244
scrambleBuff := scramblePassword(cipher, []byte(mc.cfg.Passwd))
241245

0 commit comments

Comments
 (0)