Hi,

I'm deleting my SVN co of ezc since I use GIT-SVN instead. Before
deletion I found some changes I made in my checkout. One change is what
I consider an optimization for PO.

Two things are done in the diff below:

 - save a method local reference to $this->db in $db if it's used often
 - cache quoted strings in local variables if used often

Maybe you'd like to have an entry in the issuetracker to apply these
kind of optimizations in a later version?

Index: PersistentObject/src/handlers/load_handler.php
===================================================================
--- PersistentObject/src/handlers/load_handler.php      (Revision 8797)
+++ PersistentObject/src/handlers/load_handler.php      (Arbeitskopie)
@@ -532,17 +532,19 @@
         array $objectState
     )
     {
+        $db = $this->database;
+        $relationTable_quoted = $db->quoteIdentifier( 
$relation->relationTable );
         // Join with relation table.
         $query->from(
-            $this->database->quoteIdentifier( $relation->relationTable )
+                $relationTable_quoted
         );
         foreach ( $relation->columnMap as $map )
         {
             $query->where(
                 $query->expr->eq(
-                    $this->database->quoteIdentifier( 
$relation->relationTable ) 
+                    $relationTable_quoted
                         . "." 
-                        . $this->database->quoteIdentifier( 
$map->relationSourceColumn ),
+                        . $db->quoteIdentifier( $map->relationSourceColumn ),
                     $query->bindValue(
                         
$objectState[$def->columns[$map->sourceColumn]->propertyName],
                         null,
@@ -550,12 +552,12 @@
                     )
                 ),
                 $query->expr->eq(
-                    $this->database->quoteIdentifier( 
$relation->relationTable )
+                    $relationTable_quoted
                         . "." 
-                        . $this->database->quoteIdentifier( 
$map->relationDestinationColumn ),
-                    $this->database->quoteIdentifier( 
$relation->destinationTable )
+                        . $db->quoteIdentifier( 
$map->relationDestinationColumn ),
+                    $db->quoteIdentifier( $relation->destinationTable )
                         . "." 
-                        . $this->database->quoteIdentifier( 
$map->destinationColumn )
+                        . $db->quoteIdentifier( $map->destinationColumn )
                 )
             );
         }

Best regards,
-- 
Thomas Koch, Software Developer
http://www.koch.ro

Young Media Concepts GmbH
Sonnenstr. 4
CH-8280 Kreuzlingen
Switzerland

Tel    +41 (0)71 / 508 24 86
Fax    +41 (0)71 / 560 53 89
Mobile +49 (0)170 / 753 89 16
Web    www.ymc.ch
-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to