diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-08 21:15:16 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-08 21:15:16 -0500 |
commit | c3fd9a55367a5342d517d4b77ea653dfc7447da9 (patch) | |
tree | 08d7a20b4803ec6177d358838bd43e888908f8fa /lib/sqlalchemy/sql/expression.py | |
parent | b9cc0ef3260ab5c93af3c011db7d062ba15252fe (diff) | |
download | sqlalchemy-c3fd9a55367a5342d517d4b77ea653dfc7447da9.tar.gz |
still thinking about stuff here
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 49ec34ab2..e4a610e5d 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1558,7 +1558,9 @@ class _CompareMixin(ColumnOperators): # use __radd__ to force string concat behavior return self.__compare( operators.like_op, - literal_column("'%'", type_=sqltypes.String).__radd__(self._check_literal(operators.like_op, other)), + literal_column("'%'", type_=sqltypes.String).__radd__( + self._check_literal(operators.like_op, other) + ), escape=escape) def endswith(self, other, escape=None): @@ -1566,7 +1568,8 @@ class _CompareMixin(ColumnOperators): return self.__compare( operators.like_op, - literal_column("'%'", type_=sqltypes.String) + self._check_literal(operators.like_op, other), + literal_column("'%'", type_=sqltypes.String) + + self._check_literal(operators.like_op, other), escape=escape) def contains(self, other, escape=None): @@ -1652,11 +1655,16 @@ class _CompareMixin(ColumnOperators): return lambda other: self.__operate(operator, other) def _bind_param(self, operator, obj): - return _BindParamClause(None, obj, _compared_to_operator=operator, _compared_to_type=self.type, unique=True) + return _BindParamClause(None, obj, + _compared_to_operator=operator, + _compared_to_type=self.type, unique=True) def _check_literal(self, operator, other): if isinstance(other, _BindParamClause) and \ isinstance(other.type, sqltypes.NullType): + # TODO: perhaps we should not mutate the incoming bindparam() + # here and instead make a copy of it. this might + # be the only place that we're mutating an incoming construct. other.type = self.type return other elif hasattr(other, '__clause_element__'): |