Skip to content

Commit 39baf7c

Browse files
Revert "connection: interpolate json.RawMessage as string (go-sql-driver#1058)"
This reverts commit c4f1976.
1 parent a266ff9 commit 39baf7c

File tree

3 files changed

+0
-38
lines changed

3 files changed

+0
-38
lines changed

AUTHORS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
Aaron Hopkins <go-sql-driver at die.net>
1515
Achille Roussel <achille.roussel at gmail.com>
16-
Alex Snast <alexsn at fb.com>
1716
Alexey Palazhchenko <alexey.palazhchenko at gmail.com>
1817
Andrew Reid <andrew.reid at tixtrack.com>
1918
Arne Hormann <arnehormann at gmail.com>

connection.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"context"
1313
"database/sql"
1414
"database/sql/driver"
15-
"encoding/json"
1615
"io"
1716
"net"
1817
"strconv"
@@ -272,14 +271,6 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
272271
}
273272
buf = append(buf, '\'')
274273
}
275-
case json.RawMessage:
276-
buf = append(buf, '\'')
277-
if mc.status&statusNoBackslashEscapes == 0 {
278-
buf = escapeBytesBackslash(buf, v)
279-
} else {
280-
buf = escapeBytesQuotes(buf, v)
281-
}
282-
buf = append(buf, '\'')
283274
case []byte:
284275
if v == nil {
285276
buf = append(buf, "NULL"...)

connection_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ package mysql
1111
import (
1212
"context"
1313
"database/sql/driver"
14-
"encoding/json"
1514
"errors"
1615
"net"
1716
"testing"
@@ -37,33 +36,6 @@ func TestInterpolateParams(t *testing.T) {
3736
}
3837
}
3938

40-
func TestInterpolateParamsJSONRawMessage(t *testing.T) {
41-
mc := &mysqlConn{
42-
buf: newBuffer(nil),
43-
maxAllowedPacket: maxPacketSize,
44-
cfg: &Config{
45-
InterpolateParams: true,
46-
},
47-
}
48-
49-
buf, err := json.Marshal(struct {
50-
Value int `json:"value"`
51-
}{Value: 42})
52-
if err != nil {
53-
t.Errorf("Expected err=nil, got %#v", err)
54-
return
55-
}
56-
q, err := mc.interpolateParams("SELECT ?", []driver.Value{json.RawMessage(buf)})
57-
if err != nil {
58-
t.Errorf("Expected err=nil, got %#v", err)
59-
return
60-
}
61-
expected := `SELECT '{\"value\":42}'`
62-
if q != expected {
63-
t.Errorf("Expected: %q\nGot: %q", expected, q)
64-
}
65-
}
66-
6739
func TestInterpolateParamsTooManyPlaceholders(t *testing.T) {
6840
mc := &mysqlConn{
6941
buf: newBuffer(nil),

0 commit comments

Comments
 (0)