I think i solved the problem.

The patch is attached.

Please, try it and see if it doesn't have any side effects.

Thanks for the help

2006/10/25, Raphael Derosso Pereira < [EMAIL PROTECTED]>:
Ok. I'll try to produce another code. I'll send you a patch as soon as I solve the problem.

2006/10/25, Oleg Broytmann < [EMAIL PROTECTED]>:
On Wed, Oct 25, 2006 at 08:55:41AM -0300, Raphael Derosso Pereira wrote:
> I'll try to adapt the code to do its job independent of order.

   I think I once did it - that's why there are two loops

            for registryClass in allClasses:

> Could you clear to me what is the objective of this method?

   It adds stright joins to all parent tables for all inheritable classes
listed in the query.

Oleg.
--
     Oleg Broytmann             http://phd.pp.ru/             [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.



--
Raphael Derosso Pereira
Engenheiro da Computação
icq: 4517421
msn: [EMAIL PROTECTED]
Phone: +55 41 3024-7430
Cel: +55 41 9661-4442



--
Raphael Derosso Pereira
Engenheiro da Computação
icq: 4517421
msn: [EMAIL PROTECTED]
Phone: +55 41 3024-7430
Cel: +55 41 9661-4442
--- __init__.py.orig    2006-10-26 20:33:30.244393825 -0200
+++ __init__.py 2006-10-26 21:32:35.758362572 -0200
@@ -38,18 +38,17 @@
                 if registryClass.sqlmeta.table in tablesDict:
                     #DSM: By default, no parents are needed for the clauses
                     tableRegistry[registryClass] = registryClass
-            for registryClass in allClasses:
-                if registryClass.sqlmeta.table in tablesDict:
-                    currentClass = registryClass.sqlmeta.parentClass
-                    while currentClass:
-                        if tableRegistry.has_key(currentClass):
-                            #DSM: Must keep the last parent needed
-                            #DSM: (to limit the number of join needed)
-                            tableRegistry[registryClass] = currentClass
-                            #DSM: Remove this class as it is a parent one
-                            #DSM: of a needed children
-                            del tableRegistry[currentClass]
-                        currentClass = currentClass.sqlmeta.parentClass
+            tableRegistryCopy = tableRegistry.copy()
+            for childClass in tableRegistryCopy:
+                if childClass not in tableRegistry:
+                    continue
+                parentClass = childClass
+                lastParent  = parentClass
+                while parentClass:
+                    if tableRegistry.has_key(parentClass):
+                        tableRegistry[childClass] = parentClass
+                        del tableRegistry[parentClass]
+                    parentClass = parentClass.sqlmeta.parentClass
             #DSM: Table registry contains only the last children
             #DSM: or standalone classes
             parentClause = []
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to