ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.arSelect.php
Go to the documentation of this file.
1<?php
2
24class arSelect extends arStatement
25{
26 protected string $table_name = '';
27 protected string $as = '';
28 protected string $field_name = '';
29
34 public function __construct(private bool $disabled_escaping = false)
35 {
36 }
37
38 public function asSQLStatement(ActiveRecord $activeRecord, ilDBInterface $db): string
39 {
40 $return = '';
41 if ($this->getTableName() !== '' && $this->getTableName() !== '0') {
42 $return .= $this->getTableName() . '.';
43 }
44 if ($this->disabled_escaping) {
45 $return .= $this->getFieldName();
46 } else {
47 $return .= $this->wrapField($this->getFieldName(), $db);
48 }
49 if ($this->getAs() && $this->getFieldName() !== '*') {
50 $return .= ' AS ' . $this->getAs();
51 }
52
53 return $return;
54 }
55
56 public function getTableName(): string
57 {
58 return $this->table_name;
59 }
60
61 public function setTableName(string $table_name): void
62 {
63 $this->table_name = $table_name;
64 }
65
66 public function getAs(): string
67 {
68 return $this->as;
69 }
70
71 public function setAs(string $as): void
72 {
73 $this->as = $as;
74 }
75
76 public function getFieldName(): string
77 {
78 return $this->field_name;
79 }
80
81 public function setFieldName(string $field_name): void
82 {
83 $this->field_name = $field_name;
84 }
85}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
asSQLStatement(ActiveRecord $activeRecord, ilDBInterface $db)
setFieldName(string $field_name)
setAs(string $as)
string $as
string $field_name
setTableName(string $table_name)
__construct(private bool $disabled_escaping=false)
string $table_name
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
wrapField(string $field, ilDBInterface $db)
Interface ilDBInterface.