From 1c49a556509ee1ae7047b8095434fb19401dc06c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 3 Jan 2006 00:36:16 +0000 Subject: 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 --- lib/sqlalchemy/sql.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy/sql.py') 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 -- cgit v1.2.1