Sorry, but the last patch didn`t actually corrected the whole problem.

This one does, but has a strange behaviour: The parent descendent joins are getting dupplicated.

For example, if we have the following hierarchy:

class C -> class B -> class A -> InheritableSQLObject

the joins added to glue A to B and B to C are placed twice.

It is probably something stupid I missed or added... :-)

But it`s too late here and I'm very tired... maybe tomorrow...

(Please, if you apply this patch to trunk, tell me so I can sync again.)

--
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-27 01:31:39.309366303 -0200
@@ -38,18 +38,18 @@
                 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 tableRegistryCopy.has_key(parentClass):
+                        if parentClass in tableRegistry:
+                            del tableRegistry[parentClass]
+                        tableRegistry[childClass] = 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