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

Method TestUpdateWithOrderBy

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

Source from the content-addressed store, hash-verified

446}
447
448func (s *StmtSuite) TestUpdateWithOrderBy(c *gc.C) {
449 stmt := table1.Update().Set(table1Col1, Literal(1))
450 stmt.Where(EqL(table1Col2, 2))
451 stmt.OrderBy(table1Col2)
452 sql, err := stmt.String("db")
453 c.Assert(err, gc.IsNil)
454
455 c.Assert(
456 sql,
457 gc.Equals,
458 "UPDATE `db`.`table1` "+
459 "SET `table1`.`col1`=1 "+
460 "WHERE `table1`.`col2`=2 "+
461 "ORDER BY `table1`.`col2`")
462}
463
464func (s *StmtSuite) TestUpdateWithLimit(c *gc.C) {
465 stmt := table1.Update().Set(table1Col1, Literal(1))

Callers

nothing calls this directly

Calls 7

LiteralFunction · 0.85
EqLFunction · 0.85
SetMethod · 0.65
UpdateMethod · 0.65
WhereMethod · 0.65
OrderByMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected