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