Skip to content

Commit

Permalink
Merge branch 'hotfix-0.1.7' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
hgouchet committed Jan 8, 2017
2 parents 0cc23b3 + beb978c commit 30645cb
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,31 @@ LikeClause : LIKE String
*/
type ShowStmt interface {
FullStmt
LikePattern() Pattern
WithColumnName() string
LikePattern() (Pattern, bool)
WithColumnName() (string, bool)
Stmt
}

// LikePattern returns the pattern used for a like query on the table list.
// If the second parameter is on, the like clause has been used.
// It implements the ShowStmt interface.
func (s ShowStatement) LikePattern() Pattern {
return s.Like
func (s ShowStatement) LikePattern() (Pattern, bool) {
var used bool
switch {
case s.Like.Equal != "":
used = true
case s.Like.Contains != "":
used = true
case s.Like.Prefix != "":
used = true
case s.Like.Suffix != "":
used = true
}
return s.Like, used
}

// WithColumnName returns the column name used to search table with this column.
// It implements the ShowStmt interface.
func (s ShowStatement) WithColumnName() string {
return s.With
func (s ShowStatement) WithColumnName() (string, bool) {
return s.With, s.With != ""
}

0 comments on commit 30645cb

Please sign in to comment.