2011-03-04 20:58:19 +00:00
|
|
|
|
#ifndef MYSQLXX_POOL_H
|
|
|
|
|
#define MYSQLXX_POOL_H
|
|
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
|
|
#include <mysql/mysqld_error.h>
|
|
|
|
|
|
|
|
|
|
#include <Poco/Util/Application.h>
|
|
|
|
|
#include <Poco/Util/LayeredConfiguration.h>
|
|
|
|
|
#include <Poco/NumberFormatter.h>
|
|
|
|
|
#include <Poco/Mutex.h>
|
|
|
|
|
#include <Poco/Exception.h>
|
|
|
|
|
#include <Poco/SharedPtr.h>
|
|
|
|
|
|
|
|
|
|
#include <Yandex/logger_useful.h>
|
|
|
|
|
#include <Yandex/daemon.h>
|
|
|
|
|
|
|
|
|
|
#include <Yandex/daemon.h>
|
|
|
|
|
|
|
|
|
|
#include <mysqlxx/Connection.h>
|
|
|
|
|
|
|
|
|
|
|
2011-03-17 20:00:04 +00:00
|
|
|
|
#define MYSQLXX_POOL_DEFAULT_START_CONNECTIONS 1
|
|
|
|
|
#define MYSQLXX_POOL_DEFAULT_MAX_CONNECTIONS 16
|
|
|
|
|
#define MYSQLXX_POOL_SLEEP_ON_CONNECT_FAIL 10
|
|
|
|
|
|
|
|
|
|
|
2011-03-04 20:58:19 +00:00
|
|
|
|
namespace mysqlxx
|
|
|
|
|
{
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Пул соединений с MySQL.
|
2011-11-17 19:28:50 +00:00
|
|
|
|
* Этот класс имеет мало отношения к mysqlxx и сделан не в стиле библиотеки. (взят из старого кода)
|
2011-03-18 20:26:54 +00:00
|
|
|
|
* Использование:
|
|
|
|
|
* mysqlxx::Pool pool("mysql_params");
|
|
|
|
|
*
|
|
|
|
|
* void thread()
|
|
|
|
|
* {
|
|
|
|
|
* mysqlxx::Pool::Entry connection = pool.Get();
|
|
|
|
|
* std::string s = connection->query("SELECT 'Hello, world!' AS world").use().fetch()["world"].getString();
|
|
|
|
|
* }
|
|
|
|
|
*/
|
2011-03-04 20:58:19 +00:00
|
|
|
|
class Pool
|
|
|
|
|
{
|
|
|
|
|
protected:
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Информация о соединении. */
|
2011-03-04 20:58:19 +00:00
|
|
|
|
struct Connection
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Connection() : ref_count(0) {}
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
mysqlxx::Connection conn;
|
|
|
|
|
int ref_count;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Соединение с базой данных. */
|
2011-03-04 20:58:19 +00:00
|
|
|
|
class Entry
|
|
|
|
|
{
|
|
|
|
|
public:
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Entry() : data(NULL), pool(NULL) {}
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
|
|
|
|
Entry(const Entry & src)
|
2011-10-05 20:21:18 +00:00
|
|
|
|
: data(src.data), pool(src.pool)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-10 20:32:42 +00:00
|
|
|
|
incrementRefCount();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
~Entry()
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-10 20:32:42 +00:00
|
|
|
|
decrementRefCount();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Entry & operator= (const Entry & src)
|
|
|
|
|
{
|
|
|
|
|
pool = src.pool;
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data)
|
2011-10-10 20:32:42 +00:00
|
|
|
|
decrementRefCount();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
data = src.data;
|
|
|
|
|
if (data)
|
2011-10-10 20:32:42 +00:00
|
|
|
|
incrementRefCount();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
return * this;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-28 19:11:13 +00:00
|
|
|
|
bool isNull() const
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return data == NULL;
|
2011-09-28 19:11:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-04 20:58:19 +00:00
|
|
|
|
operator mysqlxx::Connection & ()
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data == NULL)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
throw Poco::RuntimeException("Tried to access NULL database connection.");
|
2011-10-06 15:58:20 +00:00
|
|
|
|
forceConnected();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return data->conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
operator const mysqlxx::Connection & () const
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data == NULL)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
throw Poco::RuntimeException("Tried to access NULL database connection.");
|
2011-10-06 15:58:20 +00:00
|
|
|
|
forceConnected();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return data->conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mysqlxx::Connection * operator->() const
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data == NULL)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
throw Poco::RuntimeException("Tried to access NULL database connection.");
|
2011-10-06 15:58:20 +00:00
|
|
|
|
forceConnected();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return &data->conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysqlxx::Connection * operator->()
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data == NULL)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
throw Poco::RuntimeException("Tried to access NULL database connection.");
|
2011-10-06 15:58:20 +00:00
|
|
|
|
forceConnected();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return &data->conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Entry(Pool::Connection * conn, Pool * p)
|
|
|
|
|
: data(conn), pool(p)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-10 20:32:42 +00:00
|
|
|
|
incrementRefCount();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend class Pool;
|
|
|
|
|
|
|
|
|
|
private:
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Указатель на соединение. */
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Connection * data;
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Указатель на пул, которому мы принадлежим. */
|
2011-03-04 20:58:19 +00:00
|
|
|
|
Pool * pool;
|
|
|
|
|
|
2011-09-28 19:11:13 +00:00
|
|
|
|
/** Переподключается к базе данных в случае необходимости. Если не удалось - подождать и попробовать снова. */
|
2011-10-06 15:58:20 +00:00
|
|
|
|
void forceConnected() const
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
|
|
|
|
Poco::Util::Application & app = Poco::Util::Application::instance();
|
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (data->conn.ping())
|
2011-03-04 20:58:19 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool first = true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (first)
|
|
|
|
|
first = false;
|
|
|
|
|
else
|
2011-10-06 18:23:00 +00:00
|
|
|
|
Daemon::instance().sleep(MYSQLXX_POOL_SLEEP_ON_CONNECT_FAIL);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
app.logger().information("MYSQL: Reconnecting to " + pool->description);
|
|
|
|
|
data->conn.connect(pool->config_name);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
2011-10-05 20:21:18 +00:00
|
|
|
|
while (!data->conn.ping());
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
pool->afterConnect(data->conn);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
2011-09-28 19:11:13 +00:00
|
|
|
|
|
|
|
|
|
/** Переподключается к базе данных в случае необходимости. Если не удалось - вернуть false. */
|
|
|
|
|
bool tryForceConnected() const
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return data->conn.ping();
|
2011-09-28 19:11:13 +00:00
|
|
|
|
}
|
2011-10-10 20:32:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void incrementRefCount()
|
|
|
|
|
{
|
|
|
|
|
if (!data)
|
|
|
|
|
return;
|
|
|
|
|
++data->ref_count;
|
2011-11-30 19:14:06 +00:00
|
|
|
|
my_thread_init();
|
2011-10-10 20:32:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void decrementRefCount()
|
|
|
|
|
{
|
|
|
|
|
if (!data)
|
|
|
|
|
return;
|
|
|
|
|
--data->ref_count;
|
2011-11-30 19:14:06 +00:00
|
|
|
|
my_thread_end();
|
2011-10-10 20:32:42 +00:00
|
|
|
|
}
|
2011-03-04 20:58:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param ConfigName Имя параметра в конфигурационном файле.
|
|
|
|
|
* @param DefConn Количество подключений по-умолчанию
|
|
|
|
|
* @param MaxConn Максимальное количество подключений
|
|
|
|
|
* @param AllowMultiQueries Не используется.
|
|
|
|
|
*/
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Pool(const std::string & config_name_,
|
2011-10-06 15:26:48 +00:00
|
|
|
|
unsigned default_connections_ = MYSQLXX_POOL_DEFAULT_START_CONNECTIONS,
|
|
|
|
|
unsigned max_connections_ = MYSQLXX_POOL_DEFAULT_MAX_CONNECTIONS,
|
|
|
|
|
const std::string & init_connect_ = "")
|
|
|
|
|
: default_connections(default_connections_), max_connections(max_connections_), init_connect(init_connect_),
|
|
|
|
|
initialized(false), config_name(config_name_), was_successful(false)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Pool()
|
|
|
|
|
{
|
2011-10-06 15:26:48 +00:00
|
|
|
|
Poco::ScopedLock<Poco::FastMutex> locker(lock);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
for (Connections::iterator it = connections.begin(); it != connections.end(); it++)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
delete static_cast<Connection *>(*it);
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Выделяет соединение для работы. */
|
2011-03-04 20:58:19 +00:00
|
|
|
|
Entry Get()
|
|
|
|
|
{
|
2011-10-06 15:26:48 +00:00
|
|
|
|
Poco::ScopedLock<Poco::FastMutex> locker(lock);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:58:20 +00:00
|
|
|
|
initialize();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
2011-10-06 15:26:48 +00:00
|
|
|
|
for (Connections::iterator it = connections.begin(); it != connections.end(); it++)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if ((*it)->ref_count == 0)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
return Entry(*it, this);
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
if (connections.size() < (size_t)max_connections)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-06 15:58:20 +00:00
|
|
|
|
Connection * conn = allocConnection();
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (conn)
|
|
|
|
|
return Entry(conn, this);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
lock.unlock();
|
2011-10-06 18:23:00 +00:00
|
|
|
|
Daemon::instance().sleep(MYSQLXX_POOL_SLEEP_ON_CONNECT_FAIL);
|
2011-10-05 20:21:18 +00:00
|
|
|
|
lock.lock();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-28 19:11:13 +00:00
|
|
|
|
/** Выделяет соединение для работы.
|
|
|
|
|
* Если база недоступна - возвращает пустой объект Entry.
|
|
|
|
|
* Если пул переполнен - кидает исключение.
|
|
|
|
|
*/
|
|
|
|
|
Entry tryGet()
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Poco::ScopedLock<Poco::FastMutex> locker(lock);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:58:20 +00:00
|
|
|
|
initialize();
|
2011-09-28 19:11:13 +00:00
|
|
|
|
|
|
|
|
|
/// Поиск уже установленного, но не использующегося сейчас соединения.
|
2011-10-06 15:26:48 +00:00
|
|
|
|
for (Connections::iterator it = connections.begin(); it != connections.end(); ++it)
|
2011-09-28 19:11:13 +00:00
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if ((*it)->ref_count == 0)
|
2011-09-28 19:11:13 +00:00
|
|
|
|
{
|
|
|
|
|
Entry res(*it, this);
|
|
|
|
|
return res.tryForceConnected() ? res : Entry();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Если пул переполнен.
|
2011-10-06 15:26:48 +00:00
|
|
|
|
if (connections.size() >= max_connections)
|
2011-09-28 19:11:13 +00:00
|
|
|
|
throw Poco::Exception("mysqlxx::Pool is full");
|
|
|
|
|
|
|
|
|
|
/// Выделение нового соединения.
|
2011-10-06 15:58:20 +00:00
|
|
|
|
Connection * conn = allocConnection(true);
|
2011-10-05 20:21:18 +00:00
|
|
|
|
if (conn)
|
|
|
|
|
return Entry(conn, this);
|
2011-09-28 19:11:13 +00:00
|
|
|
|
|
|
|
|
|
return Entry();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Получить описание БД
|
|
|
|
|
std::string getDescription() const
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
return description;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Количество соединений с MySQL, создаваемых при запуске. */
|
|
|
|
|
unsigned default_connections;
|
|
|
|
|
/** Максимально возможное количество соедиений. */
|
|
|
|
|
unsigned max_connections;
|
|
|
|
|
/** Запрос, выполняющийся сразу после соединения с БД. Пример: "SET NAMES cp1251". */
|
|
|
|
|
std::string init_connect;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Признак того, что мы инициализированы. */
|
|
|
|
|
bool initialized;
|
|
|
|
|
/** Список соединений. */
|
|
|
|
|
typedef std::list<Connection *> Connections;
|
|
|
|
|
/** Список соединений. */
|
|
|
|
|
Connections connections;
|
|
|
|
|
/** Замок для доступа к списку соединений. */
|
2011-10-05 20:21:18 +00:00
|
|
|
|
Poco::FastMutex lock;
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Имя раздела в конфигурационном файле. */
|
2011-10-05 20:21:18 +00:00
|
|
|
|
std::string config_name;
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Описание соединения. */
|
2011-10-05 20:21:18 +00:00
|
|
|
|
std::string description;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Хотя бы один раз было успешное соединение. */
|
2011-09-01 18:15:15 +00:00
|
|
|
|
bool was_successful;
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Выполняет инициализацию класса, если мы еще не инициализированы. */
|
2011-10-06 15:58:20 +00:00
|
|
|
|
inline void initialize()
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-06 15:26:48 +00:00
|
|
|
|
if (!initialized)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
|
|
|
|
Poco::Util::Application & app = Poco::Util::Application::instance();
|
|
|
|
|
Poco::Util::LayeredConfiguration & cfg = app.config();
|
|
|
|
|
|
2011-10-05 20:21:18 +00:00
|
|
|
|
description = cfg.getString(config_name + ".db", "")
|
|
|
|
|
+ "@" + cfg.getString(config_name + ".host")
|
|
|
|
|
+ ":" + cfg.getString(config_name + ".port")
|
|
|
|
|
+ " as user " + cfg.getString(config_name + ".user");
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
for (unsigned i = 0; i < default_connections; i++)
|
2011-10-06 15:58:20 +00:00
|
|
|
|
allocConnection();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
initialized = true;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Создает новое соединение. */
|
2011-10-06 15:58:20 +00:00
|
|
|
|
Connection * allocConnection(bool dont_throw_if_failed_first_time = false)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
|
|
|
|
Poco::Util::Application & app = Poco::Util::Application::instance();
|
2011-10-06 15:26:48 +00:00
|
|
|
|
Connection * conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
conn = new Connection();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2011-10-05 20:21:18 +00:00
|
|
|
|
app.logger().information("MYSQL: Connecting to " + description);
|
2011-10-06 15:26:48 +00:00
|
|
|
|
conn->conn.connect(config_name);
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
catch (mysqlxx::ConnectionFailed & e)
|
|
|
|
|
{
|
2011-10-02 03:37:24 +00:00
|
|
|
|
if ((!was_successful && !dont_throw_if_failed_first_time)
|
2011-09-01 18:15:15 +00:00
|
|
|
|
|| e.errnum() == ER_ACCESS_DENIED_ERROR
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|| e.errnum() == ER_DBACCESS_DENIED_ERROR
|
|
|
|
|
|| e.errnum() == ER_BAD_DB_ERROR)
|
|
|
|
|
{
|
|
|
|
|
app.logger().error(e.what());
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
app.logger().error(e.what());
|
2011-10-06 15:26:48 +00:00
|
|
|
|
delete conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
|
|
|
|
|
if (Daemon::instance().isCancelled())
|
|
|
|
|
throw Poco::Exception("Daemon is cancelled while trying to connect to MySQL server.");
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-01 18:15:15 +00:00
|
|
|
|
was_successful = true;
|
2011-10-06 15:26:48 +00:00
|
|
|
|
afterConnect(conn->conn);
|
|
|
|
|
connections.push_back(conn);
|
|
|
|
|
return conn;
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-10-06 15:26:48 +00:00
|
|
|
|
/** Действия, выполняемые после соединения. */
|
|
|
|
|
void afterConnect(mysqlxx::Connection & conn)
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
|
|
|
|
Poco::Util::Application & app = Poco::Util::Application::instance();
|
|
|
|
|
|
|
|
|
|
/// Инициализирующий запрос (например, установка другой кодировки)
|
2011-10-06 15:26:48 +00:00
|
|
|
|
if (!init_connect.empty())
|
2011-03-04 20:58:19 +00:00
|
|
|
|
{
|
2011-10-06 15:26:48 +00:00
|
|
|
|
mysqlxx::Query q = conn.query();
|
|
|
|
|
q << init_connect;
|
|
|
|
|
app.logger().trace(q.str());
|
|
|
|
|
q.execute();
|
2011-03-04 20:58:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|