libnick 2024.12.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
sqlstatement.h
Go to the documentation of this file.
1
23#ifndef SQLSTATEMENT_H
24#define SQLSTATEMENT_H
25
26#ifndef SQLITE_HAS_CODEC
27#define SQLITE_HAS_CODEC
28#endif
29
30#include <memory>
31#include <string>
32#include <utility>
33#ifdef _WIN32
34#include <sqlcipher/sqlite3.h>
35#else
36#include "sqlite3.h"
37#endif
38
40{
45 {
46 public:
53 SqlStatement(const std::shared_ptr<sqlite3>& database, const std::string& command);
60 bool bind(int index, int value);
67 bool bind(int index, sqlite3_int64 value);
74 bool bind(int index, double value);
81 bool bind(int index, bool value);
88 bool bind(int index, const std::string& value);
96 bool bind(int index, void* value, int n);
102 bool step();
108 int getColumnInt(int index) const;
114 sqlite3_int64 getColumnInt64(int index) const;
120 double getColumnDouble(int index) const;
126 bool getColumnBool(int index) const;
132 std::string getColumnString(int index) const;
138 std::pair<const void*, size_t> getColumnBlob(int index) const;
143 operator bool() const;
144
145 private:
146 std::shared_ptr<sqlite3_stmt> m_statement;
147 };
148}
149
150#endif //SQLSTATEMENT_H
A sqlite statement.
Definition sqlstatement.h:45
bool step()
Steps through the statement.
std::string getColumnString(int index) const
Gets a string from a column.
SqlStatement(const std::shared_ptr< sqlite3 > &database, const std::string &command)
Constructs a SqlStatement.
bool bind(int index, sqlite3_int64 value)
Binds an int64 to a parameter.
bool bind(int index, void *value, int n)
Binds a blob to a parameter.
sqlite3_int64 getColumnInt64(int index) const
Gets an int64 from a column.
bool bind(int index, bool value)
Binds a bool to a parameter.
bool bind(int index, const std::string &value)
Binds a string to a parameter.
int getColumnInt(int index) const
Gets an int from a column.
bool bind(int index, double value)
Binds a double to a parameter.
bool getColumnBool(int index) const
Gets a bool from a column.
bool bind(int index, int value)
Binds an int to a parameter.
double getColumnDouble(int index) const
Gets a double from a column.
std::pair< const void *, size_t > getColumnBlob(int index) const
Gets a blob from a column.
Definition sqlcontext.h:40