Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Request #2702 Links in multiple databases
Submitted: 2004-11-05 16:39 UTC
From: p dot kirov at gmail dot com Assigned:
Status: No Feedback Package: DB_DataObject
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-05 16:39 UTC] p dot kirov at gmail dot com
Description: ------------ The DB_DataObject provide wrong sql when try to link from one database to other. Below is patch that i was created. I am not shire that this is the right way, but work for me. My database is Oracle, and i am not make test for other db. Hmmm, Is this way to send pathc? Reproduce code: --------------- --- DataObject.php 2004-11-05 15:02:03.000000000 +0200 +++ DataObjectnew.php 2004-11-05 15:03:02.000000000 +0200 @@ -2785,18 +2785,18 @@ $fullJoinAs = "AS {$joinAs}"; } + $database = $this->_database != $obj->_database ? strtoupper ( $DB->quoteIdentifier( $obj->_database ) ) . '.' : ''; switch ($joinType) { case 'INNER': case 'LEFT': case 'RIGHT': // others??? .. cross, left outer, right outer, natural..? - $this->_join .= "\n {$joinType} JOIN {$objTable} {$fullJoinAs}". - " ON {$joinAs}.{$ofield}={$table}.{$tfield} {$appendJoin} "; + $this->_join .= "\n {$joinType} JOIN {$database}{$objTable} {$fullJoinAs}". + " ON {$database}{$joinAs}.{$ofield}={$table}.{$tfield} {$appendJoin} "; break; case '': // this is just a standard multitable select.. $this->_join .= "\n , {$objTable} {$fullJoinAs} {$appendJoin}"; $this->whereAdd("{$joinAs}.{$ofield}={$table}.{$tfield}"); } - // if obj only a dataobject - eg. no extended class has been defined.. // it obvioulsy cant work out what child elements might exist... // untill we get on the fly querying of tables..

Comments

 [2004-11-13 06:18 UTC] alan_k
can you try cvs - there is code to prefix databases if the two objects use different ones.
 [2005-02-01 12:28 UTC] alan_k
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you.