dabo Commit
Revision 4579
Date: 2008-10-22 19:51:10 -0700 (Wed, 22 Oct 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4579
Changed:
U trunk/dabo/biz/dBizobj.py
U trunk/dabo/db/dBackend.py
U trunk/dabo/db/dCursorMixin.py
Log:
Added an optional alias parameter to the addFrom() method.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2008-10-23 02:37:01 UTC (rev 4578)
+++ trunk/dabo/biz/dBizobj.py 2008-10-23 02:51:10 UTC (rev 4579)
@@ -1554,8 +1554,8 @@
########## SQL Builder interface section ##############
def addField(self, exp, alias=None):
return self._CurrentCursor.addField(exp, alias)
- def addFrom(self, exp):
- return self._CurrentCursor.addFrom(exp)
+ def addFrom(self, exp, alias=None):
+ return self._CurrentCursor.addFrom(exp, alias)
def addJoin(self, tbl, exp, joinType=None):
"""Add SQL JOIN clause.
Modified: trunk/dabo/db/dBackend.py
===================================================================
--- trunk/dabo/db/dBackend.py 2008-10-23 02:37:01 UTC (rev 4578)
+++ trunk/dabo/db/dBackend.py 2008-10-23 02:51:10 UTC (rev 4579)
@@ -273,9 +273,11 @@
return self.addWithSep(clause, exp, sep=",\n%s" % indent)
- def addFrom(self, clause, exp, autoQuote=True):
+ def addFrom(self, clause, exp, alias=None, autoQuote=True):
""" Add a table to the sql statement."""
exp = self.encloseNames(exp, autoQuote=autoQuote,
keywords=("as",))
+ if alias:
+ exp = "%(exp)s as %(alias)s" % locals()
indent = len("select ") * " "
return self.addWithSep(clause, exp, sep=",\n%s" % indent)
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2008-10-23 02:37:01 UTC (rev 4578)
+++ trunk/dabo/db/dCursorMixin.py 2008-10-23 02:51:10 UTC (rev 4579)
@@ -20,6 +20,7 @@
from dabo.lib import dates
from dabo.lib.utils import noneSort, caseInsensitiveSort
+
class dCursorMixin(dObject):
"""Dabo's cursor class, representing the lowest tier."""
_call_initProperties = False
@@ -2001,7 +2002,7 @@
autoQuote=self.AutoQuoteNames)
- def addFrom(self, exp):
+ def addFrom(self, exp, alias=None):
""" Add a table to the sql statement. For joins, use
the addJoin() method.
"""
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]