PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #2702

Links in multiple databases

Details

Request #2702Links in multiple databases
Submitted2004-11-05 16:39 UTC
Fromp dot kirov at gmail dot com
StatusNo Feedback
PackageDB_DataObject
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[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..