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() PgTransactionImpl::~PgTransactionImpl()
{ {
LOG_TRACE << "Destruct";
assert(!_isWorking); assert(!_isWorking);
if (!_isCommitedOrRolledback) if (!_isCommitedOrRolledback)
{ {

View File

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