From f899157ca9f6f5104a358420eba8f1b9019ece6f Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sun, 13 Jul 2008 04:45:37 +0000 Subject: Added new basic match() operator that performs a full-text search. Supported on PostgreSQL, SQLite, MySQL, MS-SQL, and Oracle backends. --- lib/sqlalchemy/sql/expression.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index bf848654c..308f4b202 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1250,6 +1250,9 @@ class ColumnOperators(Operators): def contains(self, other, **kwargs): return self.operate(operators.contains_op, other, **kwargs) + def match(self, other, **kwargs): + return self.operate(operators.match_op, other, **kwargs) + def desc(self): return self.operate(operators.desc_op) @@ -1390,6 +1393,14 @@ class _CompareMixin(ColumnOperators): return self.__compare(operators.like_op, literal_column("'%'", type_=sqltypes.String) + self._check_literal(other) + literal_column("'%'", type_=sqltypes.String), escape=escape) + def match(self, other): + """Produce a MATCH clause, i.e. ``MATCH ''`` + + The allowed contents of ``other`` are database backend specific. + """ + + return self.__compare(operators.match_op, self._check_literal(other)) + def label(self, name): """Produce a column label, i.e. `` AS ``. -- cgit v1.2.1