MCPcopy
hub / github.com/go-sql-driver/mysql / TestInterpolateParams

Function TestInterpolateParams

connection_test.go:21–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestInterpolateParams(t *testing.T) {
22 mc := &mysqlConn{
23 buf: newBuffer(),
24 maxAllowedPacket: maxPacketSize,
25 cfg: &Config{
26 InterpolateParams: true,
27 },
28 }
29
30 q, err := mc.interpolateParams("SELECT ?+?", []driver.Value{int64(42), "gopher"})
31 if err != nil {
32 t.Errorf("Expected err=nil, got %#v", err)
33 return
34 }
35 expected := `SELECT 42+'gopher'`
36 if q != expected {
37 t.Errorf("Expected: %q\nGot: %q", expected, q)
38 }
39}
40
41func TestInterpolateParamsJSONRawMessage(t *testing.T) {
42 mc := &mysqlConn{

Callers

nothing calls this directly

Calls 2

interpolateParamsMethod · 0.95
newBufferFunction · 0.85

Tested by

no test coverage detected