1 | <?php |
||
18 | class Query implements QueryInterface |
||
19 | { |
||
20 | /* @var \PDO The PDO. */ |
||
21 | private $pdo; |
||
22 | |||
23 | /* @var array The bindings. */ |
||
24 | private $bindings; |
||
25 | |||
26 | /* @var QueryBuilder The query builder. */ |
||
27 | private $queryBuilder; |
||
28 | |||
29 | /** |
||
30 | * Construct a query object with the given pdo and table. |
||
31 | * |
||
32 | * @param \PDO $pdo |
||
33 | * @param string $table |
||
34 | */ |
||
35 | 21 | public function __construct(\PDO $pdo, $table) |
|
41 | |||
42 | /** |
||
43 | * Returns a string representation of the query object. |
||
44 | * |
||
45 | * @return string a string representation of the query object. |
||
46 | */ |
||
47 | 21 | public function __toString() |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 17 | public function select($columns = ['*']) |
|
56 | { |
||
57 | 17 | $this->queryBuilder->select(is_array($columns) ? $columns : func_get_args()); |
|
58 | |||
59 | 17 | return $this; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | 1 | public function insert(array $values) |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 1 | public function update(array $values) |
|
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | 1 | public function delete() |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 1 | public function join($table, $primary, $operator, $secondary) |
|
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | 1 | public function leftJoin($table, $primary, $operator, $secondary) |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 1 | public function rightJoin($table, $primary, $operator, $secondary) |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 1 | public function crossJoin($table, $primary, $operator, $secondary) |
|
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | 7 | public function where($column, $operator, $value) |
|
146 | |||
147 | /** |
||
148 | * Set an additional where in condition. |
||
149 | * |
||
150 | * @param string $column |
||
151 | * @param array $values |
||
152 | * @return $this |
||
153 | */ |
||
154 | 1 | private function whereIn($column, $values) |
|
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | 1 | public function groupBy($column) |
|
178 | |||
179 | /** |
||
180 | * {@inheritdoc} |
||
181 | */ |
||
182 | 1 | public function orderBy($column, $order = null) |
|
188 | |||
189 | /** |
||
190 | * {@inheritdoc} |
||
191 | */ |
||
192 | 2 | public function limit($limit) |
|
199 | |||
200 | /** |
||
201 | * {@inheritdoc} |
||
202 | */ |
||
203 | 1 | public function offset($offset) |
|
210 | |||
211 | /** |
||
212 | * Returns the result of the executed prepared query. |
||
213 | * |
||
214 | * @return QueryResult the result of the executed prepared query. |
||
215 | */ |
||
216 | 4 | public function execute() |
|
240 | |||
241 | /** |
||
242 | * Returns the values array with bindings instead of values. |
||
243 | * |
||
244 | * @param array $values |
||
245 | * @return array the values array with bindings instead of values. |
||
246 | */ |
||
247 | 2 | private function replaceValuesWithBindings(array $values, $clause) |
|
259 | } |
||
260 |