We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f84dfb commit 8826242Copy full SHA for 8826242
connection.go
@@ -179,16 +179,18 @@ func (mc *mysqlConn) escapeBytes(buf, v []byte) []byte {
179
return buf
180
}
181
182
+// estimateParamLength calculates upper bound of string length from types.
183
func estimateParamLength(args []driver.Value) (int, bool) {
184
l := 0
185
for _, a := range args {
186
switch v := a.(type) {
187
case int64, float64:
- l += 20
188
+ // 24 (-1.7976931348623157e+308) may be upper bound. But I'm not sure.
189
+ l += 25
190
case bool:
- l += 5
191
+ l += 1 // 0 or 1
192
case time.Time:
- l += 30
193
+ l += 30 // '1234-12-23 12:34:56.777777'
194
case string:
195
l += len(v)*2 + 2
196
case []byte:
0 commit comments