MCPcopy Create free account
hub / github.com/dropbox/godropbox / Test55Query

Method Test55Query

database/binlog/query_event_test.go:85–136  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

83}
84
85func (s *QueryEventSuite) Test55Query(c *C) {
86 s.WriteEvent(
87 mysql_proto.LogEventType_QUERY_EVENT,
88 uint16(0),
89 []byte{
90 // thread id
91 179, 208, 22, 0,
92 // duration
93 0, 0, 0, 0,
94 // db name length
95 6,
96 // error code
97 0, 0,
98 // status length
99 26, 0,
100 // status block
101 0, 0, 0, 0, 0,
102 1, 0, 0, 0, 0, 0, 0, 0, 0,
103 6, 3, 115, 116, 100,
104 4, 33, 0, 33, 0, 192, 0,
105 // db name
106 103, 108, 111, 98, 97, 108, 0,
107 // query
108 66, 69, 71, 73, 78})
109
110 event, err := s.NextEvent()
111 c.Assert(err, IsNil)
112
113 c.Assert(event, NotNil)
114 q, ok := event.(*QueryEvent)
115 c.Assert(ok, IsTrue)
116 c.Check(q.ThreadId(), Equals, uint32(0x0016d0b3))
117 c.Check(q.Duration(), Equals, uint32(0))
118 c.Check(q.ErrorCode(), Equals, mysql_proto.ErrorCode_OK)
119 c.Check(
120 q.StatusBytes(),
121 DeepEquals,
122 []byte{
123 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
124 0, 0, 0, 0, 6, 3, 115, 116, 100, 4,
125 33, 0, 33, 0, 192, 0})
126 // TODO check parsed status
127 c.Check(string(q.DatabaseName()), Equals, "global")
128 c.Check(string(q.Query()), Equals, "BEGIN")
129
130 c.Assert(q.Flags2(), NotNil)
131 c.Check(*q.Flags2(), Equals, uint32(0))
132 c.Assert(q.SqlMode(), NotNil)
133 c.Check(*q.SqlMode(), Equals, uint64(0))
134 c.Check(string(q.Catalog()), Equals, "std")
135 c.Check(q.Charset(), DeepEquals, []byte{33, 0, 33, 0, 192, 0})
136}
137
138func (s *QueryEventSuite) Test56Query(c *C) {
139 s.SetChecksumSize(4)

Callers

nothing calls this directly

Calls 13

ThreadIdMethod · 0.80
DurationMethod · 0.80
ErrorCodeMethod · 0.80
StatusBytesMethod · 0.80
QueryMethod · 0.80
Flags2Method · 0.80
SqlModeMethod · 0.80
CatalogMethod · 0.80
CharsetMethod · 0.80
NextEventMethod · 0.65
DatabaseNameMethod · 0.65
WriteEventMethod · 0.45

Tested by

no test coverage detected