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

Method TestLikeExpr

database/sqlbuilder/expression_test.go:64–78  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

62}
63
64func (s *ExprSuite) TestLikeExpr(c *gc.C) {
65 expr := LikeL(table1Col1, EscapeForLike("%my_prefix")+"%")
66
67 buf := &bytes.Buffer{}
68
69 err := expr.SerializeSql(buf)
70 c.Assert(err, gc.IsNil)
71
72 sql := buf.String()
73 c.Assert(
74 sql,
75 gc.Equals,
76 "`table1`.`col1` LIKE '\\%my\\_prefix%'")
77
78}
79
80func (s *ExprSuite) TestRegexExpr(c *gc.C) {
81 expr := RegexpL(table1Col1, "[[:<:]]log|[[.low-line.]]log")

Callers

nothing calls this directly

Calls 4

LikeLFunction · 0.85
EscapeForLikeFunction · 0.85
SerializeSqlMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected