|
1 | 1 | /*
|
2 | 2 | * Copyright (c) 2013-2015, Roland Bock
|
3 | 3 | * All rights reserved.
|
4 |
| - * |
| 4 | + * |
5 | 5 | * Redistribution and use in source and binary forms, with or without modification,
|
6 | 6 | * are permitted provided that the following conditions are met:
|
7 |
| - * |
| 7 | + * |
8 | 8 | * Redistributions of source code must retain the above copyright notice, this
|
9 | 9 | * list of conditions and the following disclaimer.
|
10 |
| - * |
| 10 | + * |
11 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this
|
12 | 12 | * list of conditions and the following disclaimer in the documentation and/or
|
13 | 13 | * other materials provided with the distribution.
|
14 |
| - * |
| 14 | + * |
15 | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16 | 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17 | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24 | 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 | 25 | */
|
26 | 26 |
|
27 |
| - |
28 | 27 | #ifndef SQLPP_DATABASE_BIND_RESULT_H
|
29 | 28 | #define SQLPP_DATABASE_BIND_RESULT_H
|
30 | 29 |
|
31 | 30 | #include <memory>
|
32 | 31 |
|
33 | 32 | namespace sqlpp
|
34 | 33 | {
|
35 |
| - namespace database |
36 |
| - { |
37 |
| - /* |
38 |
| - * bind_result_t binds values of a sqlpp11 result row |
39 |
| - * to the results of a statement |
40 |
| - */ |
41 |
| - class bind_result_t |
42 |
| - { |
43 |
| - public: |
44 |
| - bind_result_t(); // default constructor for a result that will not yield a valid row |
45 |
| - bind_result_t(...); |
46 |
| - bind_result_t(const bind_result_t&) = delete; |
47 |
| - bind_result_t(bind_result_t&& rhs); |
48 |
| - bind_result_t& operator=(const bind_result_t&) = delete; |
49 |
| - bind_result_t& operator=(bind_result_t&&); |
50 |
| - ~bind_result_t(); |
51 |
| - |
52 |
| - bool operator==(const bind_result_t& rhs) const; |
| 34 | + namespace database |
| 35 | + { |
| 36 | + /* |
| 37 | + * bind_result_t binds values of a sqlpp11 result row |
| 38 | + * to the results of a statement |
| 39 | + */ |
| 40 | + class bind_result_t |
| 41 | + { |
| 42 | + public: |
| 43 | + bind_result_t(); // default constructor for a result that will not yield a valid row |
| 44 | + bind_result_t(...); |
| 45 | + bind_result_t(const bind_result_t&) = delete; |
| 46 | + bind_result_t(bind_result_t&& rhs); |
| 47 | + bind_result_t& operator=(const bind_result_t&) = delete; |
| 48 | + bind_result_t& operator=(bind_result_t&&); |
| 49 | + ~bind_result_t(); |
53 | 50 |
|
54 |
| - template<typename ResultRow> |
55 |
| - void next(ResultRow& result_row); |
| 51 | + bool operator==(const bind_result_t& rhs) const; |
56 | 52 |
|
57 |
| - // something similar to this: |
58 |
| - /* |
59 |
| - { |
60 |
| - if (!_handle) |
61 |
| - { |
62 |
| - result_row.invalidate(); |
63 |
| - return; |
64 |
| - } |
| 53 | + template <typename ResultRow> |
| 54 | + void next(ResultRow& result_row); |
65 | 55 |
|
66 |
| - if (next_impl()) |
67 |
| - { |
68 |
| - if (not result_row) |
69 |
| - { |
70 |
| - result_row.validate(); |
71 |
| - } |
72 |
| - result_row._bind(*this); // bind result row values to results |
73 |
| - } |
74 |
| - else |
75 |
| - { |
76 |
| - if (result_row) |
77 |
| - result_row.invalidate(); |
78 |
| - } |
79 |
| - }; |
80 |
| - */ |
| 56 | + // something similar to this: |
| 57 | + /* |
| 58 | + { |
| 59 | + if (!_handle) |
| 60 | + { |
| 61 | + result_row.invalidate(); |
| 62 | + return; |
| 63 | + } |
81 | 64 |
|
82 |
| - // These are called by the result row to bind individual result values |
83 |
| - // More will be added over time |
84 |
| - void _bind_boolean_result(size_t index, signed char* value, bool* is_null); |
85 |
| - void _bind_floating_point_result(size_t index, double* value, bool* is_null); |
86 |
| - void _bind_integral_result(size_t index, int64_t* value, bool* is_null); |
87 |
| - void _bind_text_result(size_t index, const char** text, size_t* len); |
88 |
| - ... |
89 |
| - }; |
| 65 | + if (next_impl()) |
| 66 | + { |
| 67 | + if (not result_row) |
| 68 | + { |
| 69 | + result_row.validate(); |
| 70 | + } |
| 71 | + result_row._bind(*this); // bind result row values to results |
| 72 | + } |
| 73 | + else |
| 74 | + { |
| 75 | + if (result_row) |
| 76 | + result_row.invalidate(); |
| 77 | + } |
| 78 | + }; |
| 79 | + */ |
90 | 80 |
|
91 |
| - } |
| 81 | + // These are called by the result row to bind individual result values |
| 82 | + // More will be added over time |
| 83 | + void _bind_boolean_result(size_t index, signed char* value, bool* is_null); |
| 84 | + void _bind_floating_point_result(size_t index, double* value, bool* is_null); |
| 85 | + void _bind_integral_result(size_t index, int64_t* value, bool* is_null); |
| 86 | + void _bind_text_result(size_t index, const char** text, size_t* len); |
| 87 | + ... |
| 88 | + }; |
| 89 | + } |
92 | 90 | }
|
93 | 91 | #endif
|
0 commit comments