ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.arJoin.php
Go to the documentation of this file.
1 <?php
2 require_once(dirname(__FILE__) . '/../Statement/class.arStatement.php');
3 
11 class arJoin extends arStatement {
12 
13  const TYPE_NORMAL = self::TYPE_INNER;
14  const TYPE_LEFT = 'LEFT';
15  const TYPE_RIGHT = 'RIGHT';
16  const TYPE_INNER = 'INNER';
20  protected $type = self::TYPE_NORMAL;
24  protected $table_name = '';
28  protected $fields = array( '*' );
32  protected $operator = '=';
36  protected $on_first_field = '';
40  protected $on_second_field = '';
44  protected $full_names = false;
48  protected $both_external = false;
52  protected $is_mapped = false;
53 
54 
60  protected function asStatementText(ActiveRecord $ar, $as = ' AS ') {
61  $return = ' ' . $this->getType() . ' ';
62  $return .= ' JOIN ' . $this->getTableName() . $as . $this->getTableNameAs();
63  if ($this->getBothExternal()) {
64  $return .= ' ON ' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
65  } else {
66  $return .= ' ON ' . $ar->getConnectorContainerName() . '.' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
67  }
68  $return .= $this->getTableNameAs() . '.' . $this->getOnSecondField();
69 
70  return $return;
71  }
72 
73 
79  public function asSQLStatement(ActiveRecord $ar) {
80  return $this->asStatementText($ar, ' AS ');
81  }
82 
83 
88  public function asORACLEStatement(ActiveRecord $ar) {
89  return $this->asStatementText($ar, ' ');
90  }
91 
92 
93  public function setLeft() {
94  $this->setType(self::TYPE_LEFT);
95  }
96 
97 
98  public function setRght() {
99  $this->setType(self::TYPE_RIGHT);
100  }
101 
102 
103  public function setInner() {
104  $this->setType(self::TYPE_INNER);
105  }
106 
107 
111  public function setFields($fields) {
112  $this->fields = $fields;
113  }
114 
115 
119  public function getFields() {
120  return $this->fields;
121  }
122 
123 
127  public function setOnFirstField($on_first_field) {
128  $this->on_first_field = $on_first_field;
129  }
130 
131 
135  public function getOnFirstField() {
136  return $this->on_first_field;
137  }
138 
139 
144  $this->on_second_field = $on_second_field;
145  }
146 
147 
151  public function getOnSecondField() {
152  return $this->on_second_field;
153  }
154 
155 
159  public function setOperator($operator) {
160  $this->operator = $operator;
161  }
162 
163 
167  public function getOperator() {
168  return $this->operator;
169  }
170 
171 
175  public function setTableName($table_name) {
176  $this->table_name = $table_name;
177  }
178 
179 
183  public function getTableName() {
184  return $this->table_name;
185  }
186 
187 
191  public function setType($type) {
192  $this->type = $type;
193  }
194 
195 
199  public function getType() {
200  return $this->type;
201  }
202 
203 
207  public function setBothExternal($both_external) {
208  $this->both_external = $both_external;
209  }
210 
211 
215  public function getBothExternal() {
216  return $this->both_external;
217  }
218 
219 
223  public function setFullNames($full_names) {
224  $this->full_names = $full_names;
225  }
226 
227 
231  public function getFullNames() {
232  return $this->full_names;
233  }
234 
235 
239  public function isIsMapped() {
240  return $this->is_mapped;
241  }
242 
243 
247  public function setIsMapped($is_mapped) {
248  $this->is_mapped = $is_mapped;
249  }
250 }
251 
252 ?>
Class arJoin.
setOnFirstField($on_first_field)
const TYPE_LEFT
Class ActiveRecord.
setIsMapped($is_mapped)
getFullNames()
const TYPE_INNER
setTableName($table_name)
asORACLEStatement(ActiveRecord $ar)
getTableName()
Class arStatement.
setOperator($operator)
$errors fields
Definition: imgupload.php:52
getBothExternal()
setFullNames($full_names)
asSQLStatement(ActiveRecord $ar)
const TYPE_NORMAL
setOnSecondField($on_second_field)
getOnFirstField()
Create styles array
The data for the language used.
const TYPE_RIGHT
$on_second_field
setType($type)
setBothExternal($both_external)
getOnSecondField()
asStatementText(ActiveRecord $ar, $as=' AS ')
setFields($fields)