2017-09-30 23:51:01 +02:00
|
|
|
#ifndef SAPPHIRE_STATEMENTTASK_H
|
|
|
|
#define SAPPHIRE_STATEMENTTASK_H
|
|
|
|
|
|
|
|
#include <string>
|
2017-10-07 23:10:13 +02:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2017-09-30 23:51:01 +02:00
|
|
|
#include "Operation.h"
|
|
|
|
|
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
namespace Db
|
|
|
|
{
|
|
|
|
class PreparedStatement;
|
|
|
|
|
|
|
|
class StatementTask : public Operation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
StatementTask( const std::string& sql, bool async = false );
|
|
|
|
|
|
|
|
~StatementTask();
|
|
|
|
|
|
|
|
bool execute() override;
|
|
|
|
|
|
|
|
// QueryResultFuture getFuture() const
|
|
|
|
// {
|
|
|
|
// return m_result->get_future();
|
|
|
|
// }
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string m_sql;
|
|
|
|
bool m_hasResult;
|
|
|
|
// QueryResultPromise *m_result;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PreparedStatementTask : public Operation
|
|
|
|
{
|
|
|
|
public:
|
2017-10-07 23:10:13 +02:00
|
|
|
PreparedStatementTask( boost::shared_ptr< PreparedStatement > stmt, bool async = false);
|
2017-09-30 23:51:01 +02:00
|
|
|
~PreparedStatementTask();
|
|
|
|
|
|
|
|
bool execute() override;
|
|
|
|
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
|
|
|
|
|
|
|
|
protected:
|
2017-10-07 23:10:13 +02:00
|
|
|
boost::shared_ptr< PreparedStatement > m_stmt;
|
2017-09-30 23:51:01 +02:00
|
|
|
bool m_hasResult;
|
|
|
|
//PreparedQueryResultPromise* m_result;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //SAPPHIRE_STATEMENTTASK_H
|