Gazebo Transport

API Reference

11.4.1
gz/transport/log/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 ignition
29 {
30  namespace transport
31  {
32  namespace log
33  {
34  // Inline bracket to help doxygen filtering.
35  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
36  //
44  class IGNITION_TRANSPORT_LOG_VISIBLE SqlParameter
45  {
47  public: enum class ParamType : int
48  {
49  NULL_TYPE,
50  INTEGER,
51  REAL,
52  TEXT
53  // TODO(anyone): Consider supporting blob types
54  };
55 
58  public: SqlParameter();
59 
62  public: explicit SqlParameter(std::nullptr_t);
63 
67  public: explicit SqlParameter(int64_t _integer);
68 
72  public: explicit SqlParameter(double _real);
73 
77  public: explicit SqlParameter(const std::string &_string);
78 
81  public: SqlParameter(const SqlParameter &_other);
82 
85  public: SqlParameter(SqlParameter &&_other); // NOLINT
86 
90  public: SqlParameter &operator=(const SqlParameter &_other);
91 
95  public: SqlParameter &operator=(SqlParameter &&_other); // NOLINT
96 
99  public: void Set(std::nullptr_t _np);
100 
103  public: void Set(int64_t _integer);
104 
107  public: void Set(double _real);
108 
111  public: void Set(const std::string &_text);
112 
115  public: ParamType Type() const;
116 
120  public: const int64_t *QueryInteger() const;
121 
125  public: const double *QueryReal() const;
126 
130  public: const std::string *QueryText() const;
131 
133  public: ~SqlParameter();
134 
136  private: class Implementation;
137 
138 #ifdef _WIN32
139 // Disable warning C4251 which is triggered by
140 // std::*
141 #pragma warning(push)
142 #pragma warning(disable: 4251)
143 #endif
144  private: std::unique_ptr<Implementation> dataPtr;
146 #ifdef _WIN32
147 #pragma warning(pop)
148 #endif
149  };
150 
153  struct IGNITION_TRANSPORT_LOG_VISIBLE SqlStatement
154  {
155 #ifdef _WIN32
156 // Disable warning C4251 which is triggered by
157 // std::*
158 #pragma warning(push)
159 #pragma warning(disable: 4251)
160 #endif
161  public: std::string statement;
163 
166 #ifdef _WIN32
167 #pragma warning(pop)
168 #endif
169 
175  public: void Append(const SqlStatement &_other);
176  };
177  }
178  }
179  }
180 }
181 
182 #endif
Definition: gz/transport/AdvertiseOptions.hh:28
STL class.
STL class.
A class which contains a SQL statement parameter. SqlParameter can be useful for keeping SQL queries ...
Definition: gz/transport/log/SqlStatement.hh:44
T log(T... args)
ParamType
An enum to indicate which type of parameter this is.
Definition: gz/transport/log/SqlStatement.hh:47
std::vector< SqlParameter > parameters
Parameters for the statement.
Definition: gz/transport/log/SqlStatement.hh:165
A statement for a SQL query. These are generated by the QueryOptions class to control how messages ge...
Definition: gz/transport/log/SqlStatement.hh:153