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

Method TestSelectCopy

database/sqlbuilder/statement_test.go:85–104  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

83}
84
85func (s *StmtSuite) TestSelectCopy(c *gc.C) {
86 q := table1.Select(table1Col1).Where(GtL(table1Col1, 123))
87 qq := q.Copy().Where(GtL(table1Col1, 321)).OrderBy(table1Col1)
88
89 // Initial query unchanged
90 sql, err := q.String("db")
91 c.Assert(err, gc.IsNil)
92 c.Assert(
93 sql,
94 gc.Equals,
95 "SELECT `table1`.`col1` FROM `db`.`table1` WHERE `table1`.`col1`>123")
96 // New query changed
97 sql, err = qq.String("db")
98 c.Assert(err, gc.IsNil)
99 c.Assert(
100 sql,
101 gc.Equals,
102 "SELECT `table1`.`col1` FROM `db`.`table1` WHERE `table1`.`col1`>321 ORDER BY `table1`.`col1`")
103
104}
105
106func (s *StmtSuite) TestSelectLimitWithoutOffset(c *gc.C) {
107 q := table1.Select(table1Col1).Limit(5)

Callers

nothing calls this directly

Calls 6

GtLFunction · 0.85
WhereMethod · 0.65
SelectMethod · 0.65
OrderByMethod · 0.65
CopyMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected