diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-01-03 00:36:16 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-01-03 00:36:16 +0000 |
commit | 1c49a556509ee1ae7047b8095434fb19401dc06c (patch) | |
tree | 2d8233f2cc1268a45ab1ab4d7ca6f8ee7d03b496 /lib/sqlalchemy/sql.py | |
parent | ad7938a8e0c2b0d57954b7d5ec1e0b2ad9552625 (diff) | |
download | sqlalchemy-1c49a556509ee1ae7047b8095434fb19401dc06c.tar.gz |
type objects pass engine around to get a hold of DBAPI type objects
added dbapi.Binary creation to base BinaryType
fixed MySQL binary type
adjustment to Join._match_primaries to work better with self-referential table
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r-- | lib/sqlalchemy/sql.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 4386c3e5d..c1ff9a531 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -519,8 +519,8 @@ class BindParamClause(ClauseElement, CompareMixin): return [] def hash_key(self): return "BindParam(%s, %s, %s)" % (repr(self.key), repr(self.value), repr(self.shortname)) - def typeprocess(self, value): - return self.type.convert_bind_param(value) + def typeprocess(self, value, engine): + return self.type.convert_bind_param(value, engine) class TextClause(ClauseElement): """represents literal a SQL text fragment. public constructor is the @@ -694,16 +694,17 @@ class Join(FromClause): if fk.references(primary): crit.append(primary._get_col_by_original(fk.column) == fk.parent) self.foreignkey = fk.parent - for fk in primary.foreign_keys: - if fk.references(secondary): - crit.append(secondary._get_col_by_original(fk.column) == fk.parent) - self.foreignkey = fk.parent + if primary is not secondary: + for fk in primary.foreign_keys: + if fk.references(secondary): + crit.append(secondary._get_col_by_original(fk.column) == fk.parent) + self.foreignkey = fk.parent if len(crit) == 0: raise "Cant find any foreign key relationships between '%s' (%s) and '%s' (%s)" % (primary.name, repr(primary), secondary.name, repr(secondary)) elif len(crit) == 1: return (crit[0]) else: - return sql.and_(*crit) + return and_(*crit) def _group_parenthesized(self): """indicates if this Selectable requires parenthesis when grouped into a compound |