1 | <?php |
||
26 | class PreparedQuery extends Client |
||
27 | { |
||
28 | use QueryParameterParserTrait; |
||
29 | use SendNotificationTrait; |
||
30 | |||
31 | protected $sql; |
||
32 | private $is_prepared = false; |
||
33 | private $identifier; |
||
34 | private $converters; |
||
35 | |||
36 | /** |
||
37 | * getSignatureFor |
||
38 | * |
||
39 | * Returns a hash for a given sql query. |
||
40 | * |
||
41 | * @param string $sql Sql query |
||
42 | * @return string |
||
43 | */ |
||
44 | public static function getSignatureFor($sql) |
||
48 | |||
49 | /** |
||
50 | * __construct |
||
51 | * |
||
52 | * Build the prepared query. |
||
53 | * |
||
54 | * @param string $sql SQL query |
||
55 | * @throws FoundationException |
||
56 | */ |
||
57 | public function __construct($sql) |
||
66 | |||
67 | /** |
||
68 | * @see ClientPoolerInterface |
||
69 | */ |
||
70 | public function getClientType() |
||
74 | |||
75 | /** |
||
76 | * getClientIdentifier |
||
77 | * |
||
78 | * Return the query identifier. |
||
79 | * |
||
80 | * @return string Query identifier. |
||
81 | */ |
||
82 | public function getClientIdentifier() |
||
86 | |||
87 | /** |
||
88 | * shutdown |
||
89 | * |
||
90 | * Deallocate the statement in the database. |
||
91 | * |
||
92 | * @see ClientInterface |
||
93 | */ |
||
94 | public function shutdown() |
||
108 | |||
109 | /** |
||
110 | * execute |
||
111 | * |
||
112 | * Launch the query with the given parameters. |
||
113 | * |
||
114 | * @param array $values Query parameters |
||
115 | * @return ResultHandler |
||
116 | */ |
||
117 | public function execute(array $values = []) |
||
153 | |||
154 | /** |
||
155 | * prepare |
||
156 | * |
||
157 | * Send the query to be prepared by the server. |
||
158 | * |
||
159 | * @return PreparedQuery $this |
||
160 | */ |
||
161 | protected function prepare() |
||
174 | |||
175 | /** |
||
176 | * getSql |
||
177 | * |
||
178 | * Get the original SQL query |
||
179 | * |
||
180 | * @return string SQL query |
||
181 | */ |
||
182 | public function getSql() |
||
186 | |||
187 | /** |
||
188 | * prepareValues |
||
189 | * |
||
190 | * Prepare parameters to be sent. |
||
191 | * |
||
192 | * @param string $sql |
||
193 | * @param array $values |
||
194 | * @return array $prepared_values |
||
195 | */ |
||
196 | protected function prepareValues($sql, array $values) |
||
210 | |||
211 | /** |
||
212 | * prepareConverters |
||
213 | * |
||
214 | * Store converters needed for the query parameters. |
||
215 | * |
||
216 | * @param string $sql |
||
217 | * @return PreparedQuery $this |
||
218 | */ |
||
219 | protected function prepareConverters($sql) |
||
239 | } |
||
240 |