2021-11-27 00:53:57 +01:00
|
|
|
#pragma once
|
2017-09-30 23:51:01 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "Operation.h"
|
2018-10-24 12:53:26 +02:00
|
|
|
#include <memory>
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Db
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2018-10-28 21:53:21 +01:00
|
|
|
class PreparedStatement;
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2019-03-11 22:48:33 +01:00
|
|
|
class StatementTask : public Operation
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
|
|
|
public:
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
StatementTask( const std::string& sql, bool async = false );
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
~StatementTask();
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool execute() override;
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
private:
|
|
|
|
std::string m_sql;
|
|
|
|
bool m_hasResult;
|
|
|
|
};
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class PreparedStatementTask :
|
|
|
|
public Operation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
~PreparedStatementTask();
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool execute() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr< PreparedStatement > m_stmt;
|
|
|
|
bool m_hasResult;
|
|
|
|
};
|
2017-09-30 23:51:01 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
}
|