ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.arJoin.php
Go to the documentation of this file.
1<?php
2require_once(dirname(__FILE__) . '/../Statement/class.arStatement.php');
3
11class arJoin extends arStatement
12{
14 const TYPE_LEFT = 'LEFT';
15 const TYPE_RIGHT = 'RIGHT';
16 const TYPE_INNER = 'INNER';
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 {
62 $return = ' ' . $this->getType() . ' ';
63 $return .= ' JOIN ' . $this->getTableName() . $as . $this->getTableNameAs();
64 if ($this->getBothExternal()) {
65 $return .= ' ON ' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
66 } else {
67 $return .= ' ON ' . $ar->getConnectorContainerName() . '.' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
68 }
69 $return .= $this->getTableNameAs() . '.' . $this->getOnSecondField();
70
71 return $return;
72 }
73
74
80 public function asSQLStatement(ActiveRecord $ar)
81 {
82 return $this->asStatementText($ar, ' AS ');
83 }
84
85
90 public function asORACLEStatement(ActiveRecord $ar)
91 {
92 return $this->asStatementText($ar, ' ');
93 }
94
95
96 public function setLeft()
97 {
98 $this->setType(self::TYPE_LEFT);
99 }
100
101
102 public function setRght()
103 {
104 $this->setType(self::TYPE_RIGHT);
105 }
106
107
108 public function setInner()
109 {
110 $this->setType(self::TYPE_INNER);
111 }
112
113
117 public function setFields($fields)
118 {
119 $this->fields = $fields;
120 }
121
122
126 public function getFields()
127 {
128 return $this->fields;
129 }
130
131
136 {
137 $this->on_first_field = $on_first_field;
138 }
139
140
144 public function getOnFirstField()
145 {
147 }
148
149
154 {
155 $this->on_second_field = $on_second_field;
156 }
157
158
162 public function getOnSecondField()
163 {
165 }
166
167
171 public function setOperator($operator)
172 {
173 $this->operator = $operator;
174 }
175
176
180 public function getOperator()
181 {
182 return $this->operator;
183 }
184
185
189 public function setTableName($table_name)
190 {
191 $this->table_name = $table_name;
192 }
193
194
198 public function getTableName()
199 {
200 return $this->table_name;
201 }
202
203
207 public function setType($type)
208 {
209 $this->type = $type;
210 }
211
212
216 public function getType()
217 {
218 return $this->type;
219 }
220
221
226 {
227 $this->both_external = $both_external;
228 }
229
230
234 public function getBothExternal()
235 {
237 }
238
239
243 public function setFullNames($full_names)
244 {
245 $this->full_names = $full_names;
246 }
247
248
252 public function getFullNames()
253 {
254 return $this->full_names;
255 }
256
257
261 public function isIsMapped()
262 {
263 return $this->is_mapped;
264 }
265
266
270 public function setIsMapped($is_mapped)
271 {
272 $this->is_mapped = $is_mapped;
273 }
274}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class arJoin.
setFields($fields)
const TYPE_INNER
asSQLStatement(ActiveRecord $ar)
getOnFirstField()
$on_second_field
setIsMapped($is_mapped)
asStatementText(ActiveRecord $ar, $as=' AS ')
const TYPE_NORMAL
setOperator($operator)
getBothExternal()
setBothExternal($both_external)
setFullNames($full_names)
getFullNames()
const TYPE_RIGHT
getTableName()
setTableName($table_name)
asORACLEStatement(ActiveRecord $ar)
setOnSecondField($on_second_field)
const TYPE_LEFT
getOnSecondField()
setOnFirstField($on_first_field)
setType($type)
Class arStatement.
$as
$errors fields
Definition: imgupload.php:51