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 | 14 | 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 | 14 | public function __toString() |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 10 | 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 | 4 | public function where($column, $operator, $value) |
|
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | 1 | public function groupBy($column) |
|
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | 1 | public function orderBy($column, $order = null) |
|
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | 2 | public function limit($limit) |
|
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | 1 | public function offset($offset) |
|
146 | |||
147 | /** |
||
148 | * Returns the result of the executed prepared query. |
||
149 | * |
||
150 | * @return QueryResult the result of the executed prepared query. |
||
151 | */ |
||
152 | 4 | public function execute() |
|
159 | |||
160 | /** |
||
161 | * Returns the values array with bindings instead of values. |
||
162 | * |
||
163 | * @param array $values |
||
164 | * @return array the values array with bindings instead of values. |
||
165 | */ |
||
166 | 2 | private function replaceValuesWithBindings(array $values) |
|
179 | } |
||
180 |