2020
2121#include " objects/object_base.hpp"
2222
23+ #include " objects/future.hpp"
2324#include " objects/statement.hpp"
2425
2526namespace test { namespace driver {
@@ -36,20 +37,13 @@ class Prepared : public Object<const CassPrepared, cass_prepared_free> {
3637 : Object<const CassPrepared, cass_prepared_free>() {}
3738
3839 /* *
39- * Create the prepared object from the native driver object
40+ * Create the prepared object from a future object
4041 *
41- * @param prepared Native driver object
42+ * @param future Wrapped driver object
4243 */
43- Prepared (const CassPrepared* prepared)
44- : Object<const CassPrepared, cass_prepared_free>(prepared) {}
45-
46- /* *
47- * Create the prepared object from a shared reference
48- *
49- * @param prepared Shared reference
50- */
51- Prepared (Ptr prepared)
52- : Object<const CassPrepared, cass_prepared_free>(prepared) {}
44+ Prepared (Future future)
45+ : Object<const CassPrepared, cass_prepared_free>(future.prepared())
46+ , future_(future) {}
5347
5448 /* *
5549 * Bind the prepared object and create a statement
@@ -93,6 +87,30 @@ class Prepared : public Object<const CassPrepared, cass_prepared_free> {
9387 * @return Value type at the specified column index
9488 */
9589 CassValueType value_type (const std::string& name) { return cass_data_type_type (data_type (name)); }
90+
91+ /* *
92+ * Get the error code from the future
93+ *
94+ * @return Error code of the future
95+ */
96+ CassError error_code () { return future_.error_code (); }
97+
98+ /* *
99+ * Get the human readable description of the error code
100+ *
101+ * @return Error description
102+ */
103+ const std::string error_description () { return future_.error_description (); }
104+
105+ /* *
106+ * Get the error message of the future if an error occurred
107+ *
108+ * @return Error message
109+ */
110+ const std::string error_message () { return future_.error_message (); }
111+
112+ private:
113+ Future future_;
96114};
97115
98116}} // namespace test::driver
0 commit comments