2012-04-29 18:52:25 +00:00
|
|
|
//
|
|
|
|
// StatementCreator.h
|
|
|
|
//
|
|
|
|
// Library: Data
|
|
|
|
// Package: DataCore
|
|
|
|
// Module: StatementCreator
|
|
|
|
//
|
|
|
|
// Definition of the StatementCreator class.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
2014-05-04 21:02:42 +02:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2012-04-29 18:52:25 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef Data_StatementCreator_INCLUDED
|
|
|
|
#define Data_StatementCreator_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
#include "Poco/Data/Data.h"
|
|
|
|
#include "Poco/Data/SessionImpl.h"
|
|
|
|
#include "Poco/Data/Statement.h"
|
|
|
|
#include "Poco/AutoPtr.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Poco {
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
|
|
|
|
class Data_API StatementCreator
|
|
|
|
/// A StatementCreator creates Statements.
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StatementCreator();
|
|
|
|
/// Creates an unitialized StatementCreator.
|
2022-07-07 17:18:20 +08:00
|
|
|
|
2012-04-29 18:52:25 +00:00
|
|
|
StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl);
|
|
|
|
/// Creates a StatementCreator.
|
|
|
|
|
|
|
|
StatementCreator(const StatementCreator& other);
|
|
|
|
/// Creates a StatementCreator by copying another one.
|
|
|
|
|
2020-01-09 10:08:09 +01:00
|
|
|
StatementCreator(StatementCreator&& other) noexcept;
|
|
|
|
/// Creates a StatementCreator by moving another one.
|
|
|
|
|
2012-04-29 18:52:25 +00:00
|
|
|
~StatementCreator();
|
|
|
|
/// Destroys the StatementCreator.
|
|
|
|
|
|
|
|
StatementCreator& operator = (const StatementCreator& other);
|
|
|
|
/// Assignment operator.
|
2020-01-09 10:08:09 +01:00
|
|
|
|
|
|
|
StatementCreator& operator = (StatementCreator&& other) noexcept;
|
|
|
|
/// Assignment operator.
|
2022-07-07 17:18:20 +08:00
|
|
|
|
2022-06-28 19:14:36 +02:00
|
|
|
void swap(StatementCreator& other) noexcept;
|
2022-07-07 17:18:20 +08:00
|
|
|
/// Swaps the StatementCreator with another one.
|
|
|
|
|
2012-04-29 18:52:25 +00:00
|
|
|
template <typename T>
|
|
|
|
Statement operator << (const T& t)
|
|
|
|
/// Creates a Statement.
|
|
|
|
{
|
|
|
|
if (!_ptrImpl->isConnected())
|
|
|
|
throw NotConnectedException(_ptrImpl->connectionString());
|
|
|
|
|
|
|
|
Statement stmt(_ptrImpl->createStatementImpl());
|
|
|
|
stmt << t;
|
|
|
|
return stmt;
|
|
|
|
}
|
|
|
|
|
2023-11-01 00:25:21 +01:00
|
|
|
void reset();
|
|
|
|
/// Resets the StatementCreator.
|
|
|
|
|
2012-04-29 18:52:25 +00:00
|
|
|
private:
|
|
|
|
Poco::AutoPtr<SessionImpl> _ptrImpl;
|
|
|
|
};
|
|
|
|
|
2023-11-01 00:25:21 +01:00
|
|
|
//
|
|
|
|
// inlines
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
inline void StatementCreator::swap(StatementCreator& other) noexcept
|
|
|
|
{
|
|
|
|
using std::swap;
|
|
|
|
swap(_ptrImpl, other._ptrImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void StatementCreator::reset()
|
|
|
|
{
|
|
|
|
_ptrImpl = nullptr;
|
|
|
|
}
|
|
|
|
|
2012-04-29 18:52:25 +00:00
|
|
|
|
|
|
|
} } // namespace Poco::Data
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Data_StatementCreator_INCLUDED
|