aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/go-sql-driver/mysql/connection.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-sql-driver/mysql/connection.go')
-rw-r--r--vendor/github.com/go-sql-driver/mysql/connection.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go
index c3899de..d82c728 100644
--- a/vendor/github.com/go-sql-driver/mysql/connection.go
+++ b/vendor/github.com/go-sql-driver/mysql/connection.go
@@ -22,7 +22,7 @@ type mysqlConn struct {
affectedRows uint64
insertId uint64
cfg *Config
- maxPacketAllowed int
+ maxAllowedPacket int
maxWriteSize int
writeTimeout time.Duration
flags clientFlag
@@ -135,6 +135,11 @@ func (mc *mysqlConn) Prepare(query string) (driver.Stmt, error) {
}
func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (string, error) {
+ // Number of ? should be same to len(args)
+ if strings.Count(query, "?") != len(args) {
+ return "", driver.ErrSkip
+ }
+
buf := mc.buf.takeCompleteBuffer()
if buf == nil {
// can not take the buffer. Something must be wrong with the connection
@@ -241,7 +246,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
return "", driver.ErrSkip
}
- if len(buf)+4 > mc.maxPacketAllowed {
+ if len(buf)+4 > mc.maxAllowedPacket {
return "", driver.ErrSkip
}
}