Add some logs

This commit is contained in:
antao 2018-11-15 17:53:24 +08:00
parent 701105fb64
commit 6df0f0020c
2 changed files with 6 additions and 9 deletions

View File

@ -24,6 +24,7 @@ PgTransactionImpl::PgTransactionImpl(const PgConnectionPtr &connPtr,
}
PgTransactionImpl::~PgTransactionImpl()
{
LOG_TRACE << "Destruct";
assert(!_isWorking);
if (!_isCommitedOrRolledback)
{

View File

@ -36,20 +36,15 @@ int main()
{
auto trans = client->newTransaction();
*trans << "delete from users where user_uuid=201" >>
[](const Result &r) {
[trans](const Result &r) {
std::cout << "delete " << r.affectedRows() << "user!!!!!" << std::endl;
trans->rollback();
} >>
[](const DrogonDbException &e) {
std::cout << e.base().what() << std::endl;
};
*trans << "dlelf from users" >>
[](const Result &r) {
std::cout << "delete " << r.affectedRows() << "user!!!!!" << std::endl;
} >>
[](const DrogonDbException &e) {
std::cout << e.base().what() << std::endl;
};
*trans << "dlelf111 from users" >>
*trans << "delete from users where user_uuid=201" >>
[](const Result &r) {
std::cout << "delete " << r.affectedRows() << "user!!!!!" << std::endl;
} >>
@ -57,6 +52,7 @@ int main()
std::cout << e.base().what() << std::endl;
};
}
Mapper<User> mapper(client);
auto U = mapper.findByPrimaryKey(2);
std::cout << "id=" << U._userId << std::endl;