MCPcopy
hub / github.com/dropbox/godropbox / TestNestedInnerJoin

Method TestNestedInnerJoin

database/sqlbuilder/table_test.go:157–173  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

155}
156
157func (s *TableSuite) TestNestedInnerJoin(c *gc.C) {
158 join1 := table1.InnerJoinOn(table2, Eq(table1Col3, table2Col3))
159 join2 := join1.InnerJoinOn(table3, Eq(table1Col1, table3Col1))
160
161 buf := &bytes.Buffer{}
162
163 err := join2.SerializeSql("db", buf)
164 c.Assert(err, gc.IsNil)
165
166 sql := buf.String()
167 c.Assert(
168 sql,
169 gc.Equals,
170 "`db`.`table1` "+
171 "JOIN `db`.`table2` ON `table1`.`col3`=`table2`.`col3` "+
172 "JOIN `db`.`table3` ON `table1`.`col1`=`table3`.`col1`")
173}
174
175func (s *TableSuite) TestNestedLeftJoin(c *gc.C) {
176 join1 := table1.InnerJoinOn(table2, Eq(table1Col3, table2Col3))

Callers

nothing calls this directly

Calls 4

EqFunction · 0.85
InnerJoinOnMethod · 0.65
SerializeSqlMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected