Line data Source code
1 : /*
2 : * Header:
3 : * libsnapwebsites/src/libdbproxy/order_result.h
4 : *
5 : * Description:
6 : * Handle receiving results from a CQL order sent to snapdbproxy.
7 : *
8 : * Documentation:
9 : * See the corresponding .cpp file.
10 : *
11 : * License:
12 : * Copyright (c) 2011-2019 Made to Order Software Corp. All Rights Reserved
13 : *
14 : * https://snapwebsites.org/
15 : * contact@m2osw.com
16 : *
17 : * Permission is hereby granted, free of charge, to any person obtaining a
18 : * copy of this software and associated documentation files (the
19 : * "Software"), to deal in the Software without restriction, including
20 : * without limitation the rights to use, copy, modify, merge, publish,
21 : * distribute, sublicense, and/or sell copies of the Software, and to
22 : * permit persons to whom the Software is furnished to do so, subject to
23 : * the following conditions:
24 : *
25 : * The above copyright notice and this permission notice shall be included
26 : * in all copies or substantial portions of the Software.
27 : *
28 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 : * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31 : * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
32 : * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
33 : * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
34 : * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 : */
36 : #pragma once
37 :
38 : #include "libdbproxy/consistency_level.h"
39 :
40 : #include <vector>
41 :
42 :
43 : namespace libdbproxy
44 : {
45 :
46 :
47 :
48 0 : class order_result
49 : {
50 : public:
51 : bool succeeded() const;
52 : void setSucceeded(bool success);
53 :
54 : size_t resultCount() const;
55 : const QByteArray & result(int index) const;
56 : void addResult(QByteArray const & data);
57 :
58 : QByteArray encodeResult() const;
59 : bool decodeResult(unsigned char const * encoded_result, size_t size);
60 :
61 : void swap(order_result& rhs);
62 :
63 : private:
64 : bool f_succeeded = false;
65 : std::vector<QByteArray> f_result = std::vector<QByteArray>();
66 : };
67 :
68 :
69 : } // namespace libdbproxy
70 : // vim: ts=4 sw=4 et
|