to polymorphic mappers that are using a straight "outerjoin"
clause
- sql
+ - fixed "where"/"from" criterion of select() to accept a unicode string
+ in addition to regular string - both convert to text()
- added standalone distinct() function in addition to column.distinct()
[ticket:558]
- result.last_inserted_ids() should return a list that is identically
self._append_condition('having', having)
def _append_condition(self, attribute, condition):
- if type(condition) == str:
+ if isinstance(condition, basestring):
condition = _TextClause(condition)
self.__wherecorrelator.traverse(condition)
self._process_froms(condition, False)
self.__correlated[from_obj] = from_obj
def append_from(self, fromclause):
- if type(fromclause) == str:
+ if isinstance(fromclause, basestring):
fromclause = FromClause(fromclause)
self.__correlator.traverse(fromclause)
self._process_froms(fromclause, True)
"select * from foo where lala = bar"
)
+ # test bytestring
self.runtest(select(
["foobar(a)", "pk_foo_bar(syslaal)"],
"a = 12",
),
"SELECT foobar(a), pk_foo_bar(syslaal) FROM foobar left outer join lala on foobar.foo = lala.foo WHERE a = 12")
+ # test unicode
+ self.runtest(select(
+ [u"foobar(a)", u"pk_foo_bar(syslaal)"],
+ u"a = 12",
+ from_obj = [u"foobar left outer join lala on foobar.foo = lala.foo"]
+ ),
+ u"SELECT foobar(a), pk_foo_bar(syslaal) FROM foobar left outer join lala on foobar.foo = lala.foo WHERE a = 12")
+
# test building a select query programmatically with text
s = select()
s.append_column("column1")