Gazebo Transport

API Reference

13.4.1
SqlStatement.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_TRANSPORT_LOG_SQLSTATEMENT_HH_
19 #define GZ_TRANSPORT_LOG_SQLSTATEMENT_HH_
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/transport/config.hh>
26 #include <gz/transport/log/Export.hh>
27 
28 namespace gz::transport::log
29 {
30  // Inline bracket to help doxygen filtering.
31  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
32  //
40  class GZ_TRANSPORT_LOG_VISIBLE SqlParameter
41  {
43  public: enum class ParamType : int
44  {
45  NULL_TYPE,
46  INTEGER,
47  REAL,
48  TEXT
49  // TODO(anyone): Consider supporting blob types
50  };
51 
54  public: SqlParameter();
55 
58  public: explicit SqlParameter(std::nullptr_t);
59 
63  public: explicit SqlParameter(int64_t _integer);
64 
68  public: explicit SqlParameter(double _real);
69 
73  public: explicit SqlParameter(const std::string &_string);
74 
77  public: SqlParameter(const SqlParameter &_other);
78 
81  public: SqlParameter(SqlParameter &&_other); // NOLINT
82 
86  public: SqlParameter &operator=(const SqlParameter &_other);
87 
91  public: SqlParameter &operator=(SqlParameter &&_other); // NOLINT
92 
95  public: void Set(std::nullptr_t _np);
96 
99  public: void Set(int64_t _integer);
100 
103  public: void Set(double _real);
104 
107  public: void Set(const std::string &_text);
108 
111  public: ParamType Type() const;
112 
116  public: const int64_t *QueryInteger() const;
117 
121  public: const double *QueryReal() const;
122 
126  public: const std::string *QueryText() const;
127 
129  public: ~SqlParameter();
130 
132  private: class Implementation;
133 
134 #ifdef _WIN32
135 // Disable warning C4251 which is triggered by
136 // std::*
137 #pragma warning(push)
138 #pragma warning(disable: 4251)
139 #endif
141  private: std::unique_ptr<Implementation> dataPtr;
142 #ifdef _WIN32
143 #pragma warning(pop)
144 #endif
145  };
146 
149  struct GZ_TRANSPORT_LOG_VISIBLE SqlStatement
150  {
151 #ifdef _WIN32
152 // Disable warning C4251 which is triggered by
153 // std::*
154 #pragma warning(push)
155 #pragma warning(disable: 4251)
156 #endif
159 
162 #ifdef _WIN32
163 #pragma warning(pop)
164 #endif
165 
171  public: void Append(const SqlStatement &_other);
172  };
173  }
174 }
175 
176 #endif