#define DPL_THREAD_DATABASE_SUPPORT_H
#include <string>
+#include <dpl/log/wrt_log.h>
#include <dpl/db/sql_connection.h>
#include <dpl/db/orm_interface.h>
#include <dpl/thread.h>
}
// Destroy connection
- LogDebug("Destroying thread database connection: " << m_address);
+ WrtLogD("Destroying thread database connection: %s", m_address.c_str());
delete *Connection();
void TransactionUnref()
{
- LogPedantic("Unref transaction");
+ WrtLogD("Unref transaction");
if (--(*TransactionDepth()) == 0) {
- LogPedantic("Transaction is finalized");
+ WrtLogD("Transaction is finalized");
if (*TransactionCancel()) {
- LogPedantic("Transaction will be rolled back");
+ WrtLogD("Transaction will be rolled back");
(*Connection())->RollbackTransaction();
} else {
- LogPedantic("Transaction will be commited");
+ WrtLogD("Transaction will be commited");
(*Connection())->CommitTransaction();
}
}
}
// Initialize SQL connection described in traits
- LogDebug("Attaching thread database connection: " << m_address);
+ WrtLogD("Attaching thread database connection: %s", m_address.c_str());
Connection() = new DPL::DB::SqlConnection(
m_address.c_str(), m_flags, options);
// It must not be in linger state yet
Assert(*Linger() == false);
- LogDebug("Detaching thread database connection: " << m_address);
+ WrtLogD("Detaching thread database connection: %s", m_address.c_str());
// Enter linger state
*Linger() = true;
// Calling thread must support thread database connections
Assert(!Connection().IsNull());
- LogPedantic("Begin transaction");
+ WrtLogD("Begin transaction");
// Addref transaction
if (++(*TransactionDepth()) == 1) {
- LogPedantic("Transaction is initialized");
+ WrtLogD("Transaction is initialized");
TransactionCancel() = false;
(*Connection())->BeginTransaction();
// Calling thread must support thread database connections
Assert(!Connection().IsNull());
- LogPedantic("Commit transaction");
+ WrtLogD("Commit transaction");
// Unref transation
TransactionUnref();