ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.arJoinCollection.php
Go to the documentation of this file.
1<?php
2require_once(dirname(__FILE__) . '/../Statement/class.arStatementCollection.php');
3require_once('class.arJoin.php');
4
12{
13
17 protected $table_names = array();
18
19
25 public function getSaveTableName(arJoin $statement)
26 {
27 $table_name = $statement->getTableName();
28 if (in_array($table_name, $this->table_names)) {
29 $vals = array_count_values($this->table_names);
30 $next = $vals[$table_name] + 1;
31 $statement->setFullNames(true);
32 $statement->setIsMapped(true);
33
34 return $table_name . '_' . $next;
35 } else {
36 return $table_name;
37 }
38 }
39
40
44 public function add(arStatement $statement)
45 {
46 $statement->setTableNameAs($this->getSaveTableName($statement));
47 $this->table_names[] = $statement->getTableName();
48 parent::add($statement);
49 }
50
51
55 public function asSQLStatement()
56 {
57 $return = '';
58 if ($this->hasStatements()) {
59 foreach ($this->getJoins() as $join) {
60 $return .= $join->asSQLStatement($this->getAr());
61 }
62 }
63
64 return $return;
65 }
66
67
71 public function asORACLEStatement()
72 {
73 $return = '';
74 if ($this->hasStatements()) {
75 foreach ($this->getJoins() as $join) {
76 $return .= $join->asORACLEStatement($this->getAr());
77 }
78 }
79
80 return $return;
81 }
82
83
87 public function getJoins()
88 {
89 return $this->statements;
90 }
91}
add()
Definition: add.php:2
An exception for terminatinating execution or to throw for unit testing.
Class arJoinCollection.
getSaveTableName(arJoin $statement)
add(arStatement $statement)
Class arJoin.
setIsMapped($is_mapped)
setFullNames($full_names)
getTableName()
Class arStatementCollection.
Class arStatement.
setTableNameAs($table_name_as)