[Modeling-cvs] ProjectModeling/Modeling SQLExpression.py,1.23,1.24
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-12-15 15:05:03
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv10442/Modeling Modified Files: SQLExpression.py Log Message: Fixed bug #857803: mysql: invalid generated sql for complex qualifiers Index: SQLExpression.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/SQLExpression.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** SQLExpression.py 31 Aug 2003 13:54:20 -0000 1.23 --- SQLExpression.py 15 Dec 2003 15:05:00 -0000 1.24 *************** *** 266,270 **** ## END / Internals ! def __init__(self, anEntity=None): """ --- 266,272 ---- ## END / Internals ! ! SQL92_join=1 # see _addTableJoinsForAlias() for details ! def __init__(self, anEntity=None): """ *************** *** 1462,1470 **** Calculates the SQL statements for JOIN. ! The default produces:: table0 alias0 INNER JOIN [ (some other nested join) | table1 alias1 ] ON (join condition) """ trace('alias: %s / str: %s'%(alias, str)) --- 1464,1480 ---- Calculates the SQL statements for JOIN. ! The default returns:: table0 alias0 INNER JOIN [ (some other nested join) | table1 alias1 ] ON (join condition) + except if self.SQL92_join is false: in this case, what is identified as + the "join condition" here above is appended to self._joinClauseString (for + use inside a WHERE clause), and the returned string is simply "table0 + alias0, table1 alias1, ..." + + + Returns: (str, aliases): a string (see above) and the list of aliases that + were used to compute the string. """ trace('alias: %s / str: %s'%(alias, str)) *************** *** 1479,1494 **** currentRelPath=self._internals.relPathForAlias(boundAlias) trace('relPath for bound alias: %s'%(currentRelPath)) ! str+=' '+self.sqlStringForJoinSemantic(self._internals.joinSemanticForRelPath(currentRelPath))+' ' ! str2, processedAliases=self._addTableJoinsForAlias(boundAlias, '') ! if string.find(str2, 'JOIN')!=-1: ! str+=' ( '+str2+' ) ' ! else: ! str+=str2 ! str+=' ON ' srcKeys=self._internals.sourceKeysForRelPath(currentRelPath) dstKeys=self._internals.destinationKeysForRelPath(currentRelPath) for idx in range(len(srcKeys)): ! str+='%s.%s=%s.%s AND '%(alias, srcKeys[idx], boundAlias, dstKeys[idx]) ! str=str[:-5] processedAliases_total.extend(processedAliases) --- 1489,1516 ---- currentRelPath=self._internals.relPathForAlias(boundAlias) trace('relPath for bound alias: %s'%(currentRelPath)) ! if self.SQL92_join: ! str+=' '+self.sqlStringForJoinSemantic(self._internals.joinSemanticForRelPath(currentRelPath))+' ' ! str2, processedAliases=self._addTableJoinsForAlias(boundAlias, '') ! if string.find(str2, 'JOIN')!=-1: ! str+=' ( '+str2+' ) ' ! else: ! str+=str2 ! str+=' ON ' srcKeys=self._internals.sourceKeysForRelPath(currentRelPath) dstKeys=self._internals.destinationKeysForRelPath(currentRelPath) + joinClause='' for idx in range(len(srcKeys)): ! joinClause+='%s.%s=%s.%s AND '%(alias, srcKeys[idx], boundAlias, dstKeys[idx]) ! joinClause=joinClause[:-5] ! ! if self.SQL92_join: ! str+=joinClause ! else: ! if self._joinClauseString: ! self._joinClauseString+=' AND '+joinClause ! else: ! self._joinClauseString=joinClause ! str2, processedAliases=self._addTableJoinsForAlias(boundAlias, '') ! str+=', '+str2 processedAliases_total.extend(processedAliases) |