mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-05-07 19:27:19 +02:00
Update POCO to 1.11.0
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ActiveRecord.h
|
||||
//
|
||||
// Library: ActiveRecord
|
||||
// Package: ActiveRecord
|
||||
// Module: ActiveRecord
|
||||
//
|
||||
// Copyright (c) 2020, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/ActiveRecord/ActiveRecord.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using namespace Poco::Data::Keywords;
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace ActiveRecord {
|
||||
|
||||
|
||||
void ActiveRecordBase::attach(Context::Ptr pContext)
|
||||
{
|
||||
if (_pContext) throw Poco::IllegalStateException("ActiveRecord already has a Context");
|
||||
if (!pContext) throw Poco::InvalidArgumentException("Cannot attach to a null Context");
|
||||
|
||||
_pContext = pContext;
|
||||
}
|
||||
|
||||
|
||||
void ActiveRecordBase::detach()
|
||||
{
|
||||
_pContext.reset();
|
||||
}
|
||||
|
||||
|
||||
void ActiveRecordBase::create(Context::Ptr pContext)
|
||||
{
|
||||
attach(pContext);
|
||||
insert();
|
||||
}
|
||||
|
||||
|
||||
bool ActiveRecordBase::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
std::string KeylessActiveRecord::toString() const
|
||||
{
|
||||
return ""s;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::ActiveRecord
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Context.cpp
|
||||
//
|
||||
// Library: ActiveRecord
|
||||
// Package: ActiveRecord
|
||||
// Module: Context
|
||||
//
|
||||
// Copyright (c) 2020, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/ActiveRecord/Context.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace ActiveRecord {
|
||||
|
||||
|
||||
Context::Context(const Poco::Data::Session& session):
|
||||
_session(session)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Context::Context(const std::string& connector, const std::string& connectionString):
|
||||
_session(connector, connectionString)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
StatementPlaceholderProvider::Ptr Context::statementPlaceholderProvider() const
|
||||
{
|
||||
if (_session.connector() == "postgresql")
|
||||
return std::make_unique<PostgresStatementPlaceholderProvider>();
|
||||
else
|
||||
return std::make_unique<DefaultStatementPlaceholderProvider>();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::ActiveRecord
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// IDTraits.cpp
|
||||
//
|
||||
// Library: ActiveRecord
|
||||
// Package: ActiveRecord
|
||||
// Module: IDTraits
|
||||
//
|
||||
// Copyright (c) 2020, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/ActiveRecord/IDTraits.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace ActiveRecord {
|
||||
|
||||
|
||||
const std::string IDTraits<std::string>::INVALID_ID;
|
||||
const Poco::UUID IDTraits<Poco::UUID>::INVALID_ID;
|
||||
|
||||
|
||||
} } // namespace Poco::ActiveRecord
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// StatementPlaceholderProvider.cpp
|
||||
//
|
||||
// Library: ActiveRecord
|
||||
// Package: ActiveRecord
|
||||
// Module: StatementPlaceholderProvider
|
||||
//
|
||||
// Copyright (c) 2020, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/ActiveRecord/StatementPlaceholderProvider.h"
|
||||
#include "Poco/Format.h"
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace ActiveRecord {
|
||||
|
||||
|
||||
StatementPlaceholderProvider::~StatementPlaceholderProvider()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DefaultStatementPlaceholderProvider::reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::string DefaultStatementPlaceholderProvider::next()
|
||||
{
|
||||
return "?"s;
|
||||
}
|
||||
|
||||
|
||||
void PostgresStatementPlaceholderProvider::reset()
|
||||
{
|
||||
_n = 1;
|
||||
}
|
||||
|
||||
|
||||
std::string PostgresStatementPlaceholderProvider::next()
|
||||
{
|
||||
return Poco::format("$%d"s, _n++);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::ActiveRecord
|
||||
Reference in New Issue
Block a user