incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1420585 - /incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py
Date Wed, 12 Dec 2012 09:30:49 GMT
Author: jure
Date: Wed Dec 12 09:30:48 2012
New Revision: 1420585

URL: http://svn.apache.org/viewvc?rev=1420585&view=rev
Log:
* enforce table alias for JOINs


Modified:
    incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py?rev=1420585&r1=1420584&r2=1420585&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/bloodhound/db.py Wed Dec
12 09:30:48 2012
@@ -156,7 +156,7 @@ class BloodhoundProductSQLTranslate(obje
         return current_token, tokens
 
     def _select_join(self, parent, start_token, end_words):
-        current_token = self._select_from(parent, start_token, ['ON'])
+        current_token = self._select_from(parent, start_token, ['ON'], force_alias=True)
         tokens = list()
         if current_token:
             current_token = self._token_next(parent, current_token)
@@ -167,8 +167,10 @@ class BloodhoundProductSQLTranslate(obje
                 current_token = self._token_next(parent, current_token)
         return current_token
 
-    def _select_from(self, parent, start_token, end_words, table_name_callback=None):
+    def _select_from(self, parent, start_token, end_words, table_name_callback=None, force_alias=False):
         def inject_table_view(token, name, alias):
+            if force_alias and not alias:
+                alias = name
             parent.tokens[self._token_idx(parent, token)] = sqlparse.parse(self._patch_table_view_sql(name,
                                                                                         
             alias=alias))[0]
 



Mime
View raw message