1 | // |
2 | // AbstractBinder.h |
3 | // |
4 | // Library: SQL |
5 | // Package: SQLCore |
6 | // Module: AbstractBinder |
7 | // |
8 | // Definition of the AbstractBinder class. |
9 | // |
10 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef SQL_AbstractBinder_INCLUDED |
18 | #define SQL_AbstractBinder_INCLUDED |
19 | |
20 | |
21 | #include "Poco/SQL/SQL.h" |
22 | #include "Poco/SQL/Date.h" |
23 | #include "Poco/SQL/Time.h" |
24 | #include "Poco/SQL/LOB.h" |
25 | #include "Poco/DateTime.h" |
26 | #include "Poco/Nullable.h" |
27 | #include "Poco/Any.h" |
28 | #include "Poco/Dynamic/Var.h" |
29 | #include "Poco/UTFString.h" |
30 | #include <vector> |
31 | #include <deque> |
32 | #include <list> |
33 | #include <cstddef> |
34 | |
35 | |
36 | namespace Poco { |
37 | namespace SQL { |
38 | |
39 | |
40 | enum NullData |
41 | { |
42 | NULL_GENERIC = Poco::NULL_GENERIC, |
43 | DATA_NULL_INTEGER = 1, |
44 | DATA_NULL_STRING = 2, |
45 | DATA_NULL_DATE = 3, |
46 | DATA_NULL_TIME = 4, |
47 | DATA_NULL_DATETIME = 5, |
48 | DATA_NULL_BLOB = 6, |
49 | DATA_NULL_FLOAT = 7 |
50 | }; |
51 | |
52 | |
53 | struct NullValue |
54 | { |
55 | |
56 | NullValue() |
57 | {} |
58 | |
59 | template <typename T> |
60 | operator Poco::Nullable<T>() const |
61 | { |
62 | return Poco::Nullable<T>(); |
63 | } |
64 | |
65 | template <typename T> |
66 | static NullData nullCode() |
67 | { |
68 | return SQL::NULL_GENERIC; |
69 | } |
70 | |
71 | }; |
72 | |
73 | |
74 | namespace Keywords { |
75 | |
76 | static const NullValue null; |
77 | |
78 | } // namespace Keywords |
79 | |
80 | |
81 | template <typename T> |
82 | inline bool operator==(const NullValue& nv, const Nullable<T>& n) |
83 | { |
84 | return n.isNull(); |
85 | } |
86 | |
87 | |
88 | template <typename T> |
89 | inline bool operator!=(const NullValue& nv, const Nullable<T>& n) |
90 | { |
91 | return !n.isNull(); |
92 | } |
93 | |
94 | |
95 | class Poco_SQL_API AbstractBinder |
96 | /// Interface for Binding data types to placeholders. |
97 | { |
98 | public: |
99 | typedef SharedPtr<AbstractBinder> Ptr; |
100 | |
101 | struct WhenNullCb |
102 | { |
103 | WhenNullCb() :_func(NULL) |
104 | {} |
105 | |
106 | inline bool defined() const |
107 | { |
108 | return (_func != NULL); |
109 | } |
110 | |
111 | inline void onNull() |
112 | { |
113 | if (_func) _func(_data); |
114 | } |
115 | protected: |
116 | void* _data; |
117 | void (*_func)(void*); |
118 | }; |
119 | |
120 | enum Direction |
121 | /// Binding direction for a parameter. |
122 | { |
123 | PD_IN, |
124 | PD_OUT, |
125 | PD_IN_OUT |
126 | }; |
127 | |
128 | AbstractBinder(); |
129 | /// Creates the AbstractBinder. |
130 | |
131 | virtual ~AbstractBinder(); |
132 | /// Destroys the AbstractBinder. |
133 | |
134 | virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
135 | /// Binds an Int8. |
136 | |
137 | virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN); |
138 | /// Binds an Int8 vector. |
139 | |
140 | virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN); |
141 | /// Binds an Int8 deque. |
142 | |
143 | virtual void bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir = PD_IN); |
144 | /// Binds an Int8 list. |
145 | |
146 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::Int8> >& val, Direction dir = PD_IN); |
147 | /// Binds an Int8 vector. |
148 | |
149 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int8> >& val, Direction dir = PD_IN); |
150 | /// Binds an Int8 deque. |
151 | |
152 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::Int8> >& val, Direction dir = PD_IN); |
153 | /// Binds an Int8 list. |
154 | |
155 | virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
156 | /// Binds an UInt8. |
157 | |
158 | virtual void bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir = PD_IN); |
159 | /// Binds an UInt8 vector. |
160 | |
161 | virtual void bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction dir = PD_IN); |
162 | /// Binds an UInt8 deque. |
163 | |
164 | virtual void bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir = PD_IN); |
165 | /// Binds an UInt8 list. |
166 | |
167 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::UInt8> >& val, Direction dir = PD_IN); |
168 | /// Binds an UInt8 vector. |
169 | |
170 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt8> >& val, Direction dir = PD_IN); |
171 | /// Binds an UInt8 deque. |
172 | |
173 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::UInt8> >& val, Direction dir = PD_IN); |
174 | /// Binds an UInt8 list. |
175 | |
176 | virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
177 | /// Binds an Int16. |
178 | |
179 | virtual void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir = PD_IN); |
180 | /// Binds an Int16 vector. |
181 | |
182 | virtual void bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction dir = PD_IN); |
183 | /// Binds an Int16 deque. |
184 | |
185 | virtual void bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir = PD_IN); |
186 | /// Binds an Int16 list. |
187 | |
188 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::Int16> >& val, Direction dir = PD_IN); |
189 | /// Binds an Int16 vector. |
190 | |
191 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int16> >& val, Direction dir = PD_IN); |
192 | /// Binds an Int16 deque. |
193 | |
194 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::Int16> >& val, Direction dir = PD_IN); |
195 | /// Binds an Int16 list. |
196 | |
197 | virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
198 | /// Binds an UInt16. |
199 | |
200 | virtual void bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir = PD_IN); |
201 | /// Binds an UInt16 vector. |
202 | |
203 | virtual void bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Direction dir = PD_IN); |
204 | /// Binds an UInt16 deque. |
205 | |
206 | virtual void bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir = PD_IN); |
207 | /// Binds an UInt16 list. |
208 | |
209 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::UInt16> >& val, Direction dir = PD_IN); |
210 | /// Binds an UInt16 vector. |
211 | |
212 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt16> >& val, Direction dir = PD_IN); |
213 | /// Binds an UInt16 deque. |
214 | |
215 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::UInt16> >& val, Direction dir = PD_IN); |
216 | /// Binds an UInt16 list. |
217 | |
218 | virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
219 | /// Binds an Int32. |
220 | |
221 | virtual void bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir = PD_IN); |
222 | /// Binds an Int32 vector. |
223 | |
224 | virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN); |
225 | /// Binds an Int32 deque. |
226 | |
227 | virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN); |
228 | /// Binds an Int32 list. |
229 | |
230 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::Int32> >& val, Direction dir = PD_IN); |
231 | /// Binds an Int32 vector. |
232 | |
233 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int32> >& val, Direction dir = PD_IN); |
234 | /// Binds an Int32 deque. |
235 | |
236 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::Int32> >& val, Direction dir = PD_IN); |
237 | /// Binds an Int32 list. |
238 | |
239 | virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
240 | /// Binds an UInt32. |
241 | |
242 | virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN); |
243 | /// Binds an UInt32 vector. |
244 | |
245 | virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN); |
246 | /// Binds an UInt32 deque. |
247 | |
248 | virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN); |
249 | /// Binds an UInt32 list. |
250 | |
251 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::UInt32> >& val, Direction dir = PD_IN); |
252 | /// Binds an UInt32 vector. |
253 | |
254 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt32> >& val, Direction dir = PD_IN); |
255 | /// Binds an UInt32 deque. |
256 | |
257 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::UInt32> >& val, Direction dir = PD_IN); |
258 | /// Binds an UInt32 list. |
259 | |
260 | virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
261 | /// Binds an Int64. |
262 | |
263 | virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN); |
264 | /// Binds an Int64 vector. |
265 | |
266 | virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN); |
267 | /// Binds an Int64 deque. |
268 | |
269 | virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN); |
270 | /// Binds an Int64 list. |
271 | |
272 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::Int64> >& val, Direction dir = PD_IN); |
273 | /// Binds an Int64 vector. |
274 | |
275 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::Int64> >& val, Direction dir = PD_IN); |
276 | /// Binds an Int64 deque. |
277 | |
278 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::Int64> >& val, Direction dir = PD_IN); |
279 | /// Binds an Int64 list. |
280 | |
281 | virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
282 | /// Binds an UInt64. |
283 | |
284 | virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN); |
285 | /// Binds an UInt64 vector. |
286 | |
287 | virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN); |
288 | /// Binds an UInt64 deque. |
289 | |
290 | virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN); |
291 | /// Binds an UInt64 list. |
292 | |
293 | virtual void bind(std::size_t pos, const std::vector<Nullable<Poco::UInt64> >& val, Direction dir = PD_IN); |
294 | /// Binds an UInt64 vector. |
295 | |
296 | virtual void bind(std::size_t pos, const std::deque<Nullable<Poco::UInt64> >& val, Direction dir = PD_IN); |
297 | /// Binds an UInt64 deque. |
298 | |
299 | virtual void bind(std::size_t pos, const std::list<Nullable<Poco::UInt64> >& val, Direction dir = PD_IN); |
300 | /// Binds an UInt64 list. |
301 | |
302 | #ifndef POCO_LONG_IS_64_BIT |
303 | virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
304 | /// Binds a long. |
305 | |
306 | virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
307 | /// Binds an unsiged long. |
308 | |
309 | virtual void bind(std::size_t pos, const std::vector<long>& val, Direction dir = PD_IN); |
310 | /// Binds a long vector. |
311 | |
312 | virtual void bind(std::size_t pos, const std::deque<long>& val, Direction dir = PD_IN); |
313 | /// Binds a long deque. |
314 | |
315 | virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN); |
316 | /// Binds a long list. |
317 | |
318 | virtual void bind(std::size_t pos, const std::vector<Nullable<long> >& val, Direction dir = PD_IN); |
319 | /// Binds a long vector. |
320 | |
321 | virtual void bind(std::size_t pos, const std::deque<Nullable<long> >& val, Direction dir = PD_IN); |
322 | /// Binds a long deque. |
323 | |
324 | virtual void bind(std::size_t pos, const std::list<Nullable<long> >& val, Direction dir = PD_IN); |
325 | /// Binds a long list. |
326 | #endif |
327 | |
328 | virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
329 | /// Binds a boolean. |
330 | |
331 | virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN); |
332 | /// Binds a boolean vector. |
333 | |
334 | virtual void bind(std::size_t pos, const std::deque<bool>& val, Direction dir = PD_IN); |
335 | /// Binds a boolean deque. |
336 | |
337 | virtual void bind(std::size_t pos, const std::list<bool>& val, Direction dir = PD_IN); |
338 | /// Binds a boolean list. |
339 | |
340 | |
341 | virtual void bind(std::size_t pos, const std::vector<Nullable<bool> >& val, Direction dir = PD_IN); |
342 | /// Binds a boolean vector. |
343 | |
344 | virtual void bind(std::size_t pos, const std::deque<Nullable<bool> >& val, Direction dir = PD_IN); |
345 | /// Binds a boolean deque. |
346 | |
347 | virtual void bind(std::size_t pos, const std::list<Nullable<bool> >& val, Direction dir = PD_IN); |
348 | /// Binds a boolean list. |
349 | |
350 | virtual void bind(std::size_t pos, const float& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
351 | /// Binds a float. |
352 | |
353 | virtual void bind(std::size_t pos, const std::vector<float>& val, Direction dir = PD_IN); |
354 | /// Binds a float vector. |
355 | |
356 | virtual void bind(std::size_t pos, const std::deque<float>& val, Direction dir = PD_IN); |
357 | /// Binds a float deque. |
358 | |
359 | virtual void bind(std::size_t pos, const std::list<float>& val, Direction dir = PD_IN); |
360 | /// Binds a float list. |
361 | |
362 | virtual void bind(std::size_t pos, const std::vector<Nullable<float> >& val, Direction dir = PD_IN); |
363 | /// Binds a float vector. |
364 | |
365 | virtual void bind(std::size_t pos, const std::deque<Nullable<float> >& val, Direction dir = PD_IN); |
366 | /// Binds a float deque. |
367 | |
368 | virtual void bind(std::size_t pos, const std::list<Nullable<float> >& val, Direction dir = PD_IN); |
369 | /// Binds a float list. |
370 | |
371 | virtual void bind(std::size_t pos, const double& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
372 | /// Binds a double. |
373 | |
374 | virtual void bind(std::size_t pos, const std::vector<double>& val, Direction dir = PD_IN); |
375 | /// Binds a double vector. |
376 | |
377 | virtual void bind(std::size_t pos, const std::deque<double>& val, Direction dir = PD_IN); |
378 | /// Binds a double deque. |
379 | |
380 | virtual void bind(std::size_t pos, const std::list<double>& val, Direction dir = PD_IN); |
381 | /// Binds a double list. |
382 | |
383 | virtual void bind(std::size_t pos, const std::vector<Nullable<double> >& val, Direction dir = PD_IN); |
384 | /// Binds a double vector. |
385 | |
386 | virtual void bind(std::size_t pos, const std::deque<Nullable<double> >& val, Direction dir = PD_IN); |
387 | /// Binds a double deque. |
388 | |
389 | virtual void bind(std::size_t pos, const std::list<Nullable<double> >& val, Direction dir = PD_IN); |
390 | /// Binds a double list. |
391 | |
392 | virtual void bind(std::size_t pos, const char& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
393 | /// Binds a single character. |
394 | |
395 | virtual void bind(std::size_t pos, const std::vector<char>& val, Direction dir = PD_IN); |
396 | /// Binds a character vector. |
397 | |
398 | virtual void bind(std::size_t pos, const std::deque<char>& val, Direction dir = PD_IN); |
399 | /// Binds a character deque. |
400 | |
401 | virtual void bind(std::size_t pos, const std::list<char>& val, Direction dir = PD_IN); |
402 | /// Binds a character list. |
403 | |
404 | virtual void bind(std::size_t pos, const std::vector<Nullable<char> >& val, Direction dir = PD_IN); |
405 | /// Binds a character vector. |
406 | |
407 | virtual void bind(std::size_t pos, const std::deque<Nullable<char> >& val, Direction dir = PD_IN); |
408 | /// Binds a character deque. |
409 | |
410 | virtual void bind(std::size_t pos, const std::list<Nullable<char> >& val, Direction dir = PD_IN); |
411 | /// Binds a character list. |
412 | |
413 | virtual void bind(std::size_t pos, const char* const& pVal, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
414 | /// Binds a const char ptr. |
415 | |
416 | virtual void bind(std::size_t pos, const std::string& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
417 | /// Binds a string. |
418 | |
419 | virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN); |
420 | /// Binds a string vector. |
421 | |
422 | virtual void bind(std::size_t pos, const std::deque<std::string>& val, Direction dir = PD_IN); |
423 | /// Binds a string deque. |
424 | |
425 | virtual void bind(std::size_t pos, const std::list<std::string>& val, Direction dir = PD_IN); |
426 | /// Binds a string list. |
427 | |
428 | virtual void bind(std::size_t pos, const std::vector<Nullable<std::string> >& val, Direction dir = PD_IN); |
429 | /// Binds a string vector. |
430 | |
431 | virtual void bind(std::size_t pos, const std::deque<Nullable<std::string> >& val, Direction dir = PD_IN); |
432 | /// Binds a string deque. |
433 | |
434 | virtual void bind(std::size_t pos, const std::list<Nullable<std::string> >& val, Direction dir = PD_IN); |
435 | /// Binds a string list. |
436 | |
437 | virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()); |
438 | /// Binds a UTF-16 Unicode string. |
439 | |
440 | virtual void bind(std::size_t pos, const std::vector<UTF16String>& val, Direction dir = PD_IN); |
441 | /// Binds a UTF-16 Unicode string vector. |
442 | |
443 | virtual void bind(std::size_t pos, const std::deque<UTF16String>& val, Direction dir = PD_IN); |
444 | /// Binds a UTF-16 Unicode string deque. |
445 | |
446 | virtual void bind(std::size_t pos, const std::list<UTF16String>& val, Direction dir = PD_IN); |
447 | /// Binds a UTF-16 Unicode string list. |
448 | |
449 | virtual void bind(std::size_t pos, const std::vector<Nullable<UTF16String> >& val, Direction dir = PD_IN); |
450 | /// Binds a UTF-16 Unicode string vector. |
451 | |
452 | virtual void bind(std::size_t pos, const std::deque<Nullable<UTF16String> >& val, Direction dir = PD_IN); |
453 | /// Binds a UTF-16 Unicode string deque. |
454 | |
455 | virtual void bind(std::size_t pos, const std::list<Nullable<UTF16String> >& val, Direction dir = PD_IN); |
456 | /// Binds a UTF-16 Unicode string list. |
457 | |
458 | virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
459 | /// Binds a BLOB. |
460 | |
461 | virtual void bind(std::size_t pos, const CLOB& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
462 | /// Binds a CLOB. |
463 | |
464 | virtual void bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir = PD_IN); |
465 | /// Binds a BLOB vector. |
466 | |
467 | virtual void bind(std::size_t pos, const std::deque<BLOB>& val, Direction dir = PD_IN); |
468 | /// Binds a BLOB deque. |
469 | |
470 | virtual void bind(std::size_t pos, const std::list<BLOB>& val, Direction dir = PD_IN); |
471 | /// Binds a BLOB list. |
472 | |
473 | virtual void bind(std::size_t pos, const std::vector<Nullable<BLOB> >& val, Direction dir = PD_IN); |
474 | /// Binds a BLOB vector. |
475 | |
476 | virtual void bind(std::size_t pos, const std::deque<Nullable<BLOB> >& val, Direction dir = PD_IN); |
477 | /// Binds a BLOB deque. |
478 | |
479 | virtual void bind(std::size_t pos, const std::list<Nullable<BLOB> >& val, Direction dir = PD_IN); |
480 | /// Binds a BLOB list. |
481 | |
482 | virtual void bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir = PD_IN); |
483 | /// Binds a CLOB vector. |
484 | |
485 | virtual void bind(std::size_t pos, const std::deque<CLOB>& val, Direction dir = PD_IN); |
486 | /// Binds a CLOB deque. |
487 | |
488 | virtual void bind(std::size_t pos, const std::list<CLOB>& val, Direction dir = PD_IN); |
489 | /// Binds a CLOB list. |
490 | |
491 | virtual void bind(std::size_t pos, const std::vector<Nullable<CLOB> >& val, Direction dir = PD_IN); |
492 | /// Binds a CLOB vector. |
493 | |
494 | virtual void bind(std::size_t pos, const std::deque<Nullable<CLOB> >& val, Direction dir = PD_IN); |
495 | /// Binds a CLOB deque. |
496 | |
497 | virtual void bind(std::size_t pos, const std::list<Nullable<CLOB> >& val, Direction dir = PD_IN); |
498 | /// Binds a CLOB list. |
499 | |
500 | virtual void bind(std::size_t pos, const DateTime& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
501 | /// Binds a DateTime. |
502 | |
503 | virtual void bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir = PD_IN); |
504 | /// Binds a DateTime vector. |
505 | |
506 | virtual void bind(std::size_t pos, const std::deque<DateTime>& val, Direction dir = PD_IN); |
507 | /// Binds a DateTime deque. |
508 | |
509 | virtual void bind(std::size_t pos, const std::list<DateTime>& val, Direction dir = PD_IN); |
510 | /// Binds a DateTime list. |
511 | |
512 | virtual void bind(std::size_t pos, const std::vector<Nullable<DateTime> >& val, Direction dir = PD_IN); |
513 | /// Binds a DateTime vector. |
514 | |
515 | virtual void bind(std::size_t pos, const std::deque<Nullable<DateTime> >& val, Direction dir = PD_IN); |
516 | /// Binds a DateTime deque. |
517 | |
518 | virtual void bind(std::size_t pos, const std::list<Nullable<DateTime> >& val, Direction dir = PD_IN); |
519 | /// Binds a DateTime list. |
520 | |
521 | virtual void bind(std::size_t pos, const Date& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
522 | /// Binds a Date. |
523 | |
524 | virtual void bind(std::size_t pos, const std::vector<Date>& val, Direction dir = PD_IN); |
525 | /// Binds a Date vector. |
526 | |
527 | virtual void bind(std::size_t pos, const std::deque<Date>& val, Direction dir = PD_IN); |
528 | /// Binds a Date deque. |
529 | |
530 | virtual void bind(std::size_t pos, const std::list<Date>& val, Direction dir = PD_IN); |
531 | /// Binds a Date list. |
532 | |
533 | virtual void bind(std::size_t pos, const std::vector<Nullable<Date> >& val, Direction dir = PD_IN); |
534 | /// Binds a Date vector. |
535 | |
536 | virtual void bind(std::size_t pos, const std::deque<Nullable<Date> >& val, Direction dir = PD_IN); |
537 | /// Binds a Date deque. |
538 | |
539 | virtual void bind(std::size_t pos, const std::list<Nullable<Date> >& val, Direction dir = PD_IN); |
540 | /// Binds a Date list. |
541 | |
542 | virtual void bind(std::size_t pos, const Time& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()) = 0; |
543 | /// Binds a Time. |
544 | |
545 | virtual void bind(std::size_t pos, const std::vector<Time>& val, Direction dir = PD_IN); |
546 | /// Binds a Time vector. |
547 | |
548 | virtual void bind(std::size_t pos, const std::deque<Time>& val, Direction dir = PD_IN); |
549 | /// Binds a Time deque. |
550 | |
551 | virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN); |
552 | /// Binds a Time list. |
553 | |
554 | virtual void bind(std::size_t pos, const std::vector<Nullable<Time> >& val, Direction dir = PD_IN); |
555 | /// Binds a Time vector. |
556 | |
557 | virtual void bind(std::size_t pos, const std::deque<Nullable<Time> >& val, Direction dir = PD_IN); |
558 | /// Binds a Time deque. |
559 | |
560 | virtual void bind(std::size_t pos, const std::list<Nullable<Time> >& val, Direction dir = PD_IN); |
561 | /// Binds a Time list. |
562 | |
563 | virtual void bind(std::size_t pos, const NullData& val, Direction dir = PD_IN, const std::type_info& bindType = typeid(void)) = 0; |
564 | /// Binds a null. |
565 | |
566 | virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN, const std::type_info& bindElemType = typeid(void)); |
567 | /// Binds a null vector. |
568 | |
569 | virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN, const std::type_info& bindElemType = typeid(void)); |
570 | /// Binds a null deque. |
571 | |
572 | virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN, const std::type_info& bindElemType = typeid(void)); |
573 | /// Binds a null list. |
574 | |
575 | void bind(std::size_t pos, const Any& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()); |
576 | /// Binds an Any. |
577 | |
578 | void bind(std::size_t pos, const Poco::Dynamic::Var& val, Direction dir = PD_IN, const WhenNullCb& nullCb = WhenNullCb()); |
579 | /// Binds a Var. |
580 | |
581 | virtual void reset(); |
582 | /// Resets a binder. No-op by default. Implement for binders that cache data. |
583 | |
584 | static bool isOutBound(Direction dir); |
585 | /// Returns true if direction is out bound; |
586 | |
587 | static bool isInBound(Direction dir); |
588 | /// Returns true if direction is in bound; |
589 | |
590 | static bool isInOutBound(Direction dir); |
591 | /// Returns true if direction is in and out bound; |
592 | }; |
593 | |
594 | |
595 | // |
596 | // inlines |
597 | // |
598 | inline void AbstractBinder::reset() |
599 | { |
600 | //no-op |
601 | } |
602 | |
603 | |
604 | inline bool AbstractBinder::isOutBound(Direction dir) |
605 | { |
606 | return PD_OUT == dir || PD_IN_OUT == dir; |
607 | } |
608 | |
609 | inline bool AbstractBinder::isInOutBound(Direction dir) |
610 | { |
611 | return PD_IN_OUT == dir; |
612 | } |
613 | |
614 | inline bool AbstractBinder::isInBound(Direction dir) |
615 | { |
616 | return PD_IN == dir || PD_IN_OUT == dir; |
617 | } |
618 | |
619 | |
620 | } } // namespace Poco::SQL |
621 | |
622 | |
623 | #endif // Data_AbstractBinder_INCLUDED |
624 | |