2023-12-10 23:23:15 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-12-08 22:26:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "mysql.h"
|
|
|
|
|
|
|
|
class MySQL::Statement {
|
|
|
|
struct STMTDeleter {
|
|
|
|
void operator () (MYSQL_STMT* stmt) {
|
|
|
|
mysql_stmt_close(stmt);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
public:
|
|
|
|
Statement(MYSQL* connection, const char* statement);
|
|
|
|
|
2023-12-20 22:42:13 +00:00
|
|
|
void bind(void* value, enum_field_types type, bool usigned = false);
|
2023-12-08 22:26:16 +00:00
|
|
|
void execute();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<MYSQL_STMT, STMTDeleter> stmt;
|
|
|
|
std::vector<MYSQL_BIND> param;
|
|
|
|
};
|