forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActiveRecord.cpp
More file actions
61 lines (42 loc) · 1 KB
/
ActiveRecord.cpp
File metadata and controls
61 lines (42 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// 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::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