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 | 16 | 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 | 16 | public function __toString() |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 12 | public function select($columns = ['*']) |
|
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 | 6 | public function where($column, $operator, $value) |
|
106 | |||
107 | /** |
||
108 | * Set an additional where in condition. |
||
109 | * |
||
110 | * @param string $column |
||
111 | * @param mixed $values |
||
112 | * @return $this |
||
113 | */ |
||
114 | 1 | private function whereIn($column, $values) |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 1 | public function groupBy($column) |
|
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 1 | public function orderBy($column, $order = null) |
|
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | 2 | public function limit($limit) |
|
159 | |||
160 | /** |
||
161 | * {@inheritdoc} |
||
162 | */ |
||
163 | 1 | public function offset($offset) |
|
170 | |||
171 | /** |
||
172 | * Returns the result of the executed prepared query. |
||
173 | * |
||
174 | * @return QueryResult the result of the executed prepared query. |
||
175 | */ |
||
176 | 4 | public function execute() |
|
200 | |||
201 | /** |
||
202 | * Returns the values array with bindings instead of values. |
||
203 | * |
||
204 | * @param array $values |
||
205 | * @return array the values array with bindings instead of values. |
||
206 | */ |
||
207 | 2 | private function replaceValuesWithBindings(array $values, $clause) |
|
219 | } |
||
220 |