ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 public function asSQLStatement(ActiveRecord $ar) {
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
74 public function setLeft() {
75 $this->setType(self::TYPE_LEFT);
76 }
77
78
79 public function setRght() {
80 $this->setType(self::TYPE_RIGHT);
81 }
82
83
84 public function setInner() {
85 $this->setType(self::TYPE_INNER);
86 }
87
88
92 public function setFields($fields) {
93 $this->fields = $fields;
94 }
95
96
100 public function getFields() {
101 return $this->fields;
102 }
103
104
109 $this->on_first_field = $on_first_field;
110 }
111
112
116 public function getOnFirstField() {
118 }
119
120
125 $this->on_second_field = $on_second_field;
126 }
127
128
132 public function getOnSecondField() {
134 }
135
136
140 public function setOperator($operator) {
141 $this->operator = $operator;
142 }
143
144
148 public function getOperator() {
149 return $this->operator;
150 }
151
152
156 public function setTableName($table_name) {
157 $this->table_name = $table_name;
158 }
159
160
164 public function getTableName() {
165 return $this->table_name;
166 }
167
168
172 public function setType($type) {
173 $this->type = $type;
174 }
175
176
180 public function getType() {
181 return $this->type;
182 }
183
184
189 $this->both_external = $both_external;
190 }
191
192
196 public function getBothExternal() {
198 }
199
200
204 public function setFullNames($full_names) {
205 $this->full_names = $full_names;
206 }
207
208
212 public function getFullNames() {
213 return $this->full_names;
214 }
215
216
220 public function isIsMapped() {
221 return $this->is_mapped;
222 }
223
224
228 public function setIsMapped($is_mapped) {
229 $this->is_mapped = $is_mapped;
230 }
231}
232
233?>
Class ActiveRecord.
Class arJoin.
setFields($fields)
const TYPE_INNER
asSQLStatement(ActiveRecord $ar)
getOnFirstField()
$on_second_field
setIsMapped($is_mapped)
const TYPE_NORMAL
setOperator($operator)
getBothExternal()
setBothExternal($both_external)
setFullNames($full_names)
getFullNames()
const TYPE_RIGHT
getTableName()
setTableName($table_name)
setOnSecondField($on_second_field)
const TYPE_LEFT
getOnSecondField()
setOnFirstField($on_first_field)
setType($type)
Class arStatement.
$errors fields
Definition: imgupload.php:48