From abf49b44cc47f39d6cceb83866f915bc03b7d900 Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Mon, 01 Jul 2024 18:08:34 +0000
Subject: [PATCH] reformat files
---
include/qtl_postgres_pool.hpp | 95 ++++++++++++++++++++++++-----------------------
1 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/include/qtl_postgres_pool.hpp b/include/qtl_postgres_pool.hpp
index 815ee3c..17fdfa1 100644
--- a/include/qtl_postgres_pool.hpp
+++ b/include/qtl_postgres_pool.hpp
@@ -7,64 +7,65 @@
namespace qtl
{
-namespace postgres
-{
-
-class database_pool : public qtl::database_pool<database>
-{
-public:
- database_pool() : m_port(0) { }
- virtual ~database_pool() { }
- virtual database* new_database() throw() override
+ namespace postgres
{
- database* db=new database;
- if(!db->open(m_host.data(), m_user.data(), m_password.data(), m_port, m_database.data()))
+
+ class database_pool : public qtl::database_pool<database>
{
- delete db;
- db=NULL;
- }
- else
+ public:
+ database_pool() : m_port(0) {}
+ virtual ~database_pool() {}
+ virtual database *new_database() throw() override
+ {
+ database *db = new database;
+ if (!db->open(m_host.data(), m_user.data(), m_password.data(), m_port, m_database.data()))
+ {
+ delete db;
+ db = NULL;
+ }
+ else
+ {
+ PQsetClientEncoding(db->handle(), "UTF8");
+ }
+ return db;
+ }
+
+ protected:
+ std::string m_host;
+ unsigned short m_port;
+ std::string m_database;
+ std::string m_user;
+ std::string m_password;
+ };
+
+ template <typename EventLoop>
+ class async_pool : public qtl::async_pool<async_pool<EventLoop>, EventLoop, async_connection>
{
- PQsetClientEncoding(db->handle(), "UTF8");
- }
- return db;
- }
+ typedef qtl::async_pool<async_pool<EventLoop>, EventLoop, async_connection> base_class;
-protected:
- std::string m_host;
- unsigned short m_port;
- std::string m_database;
- std::string m_user;
- std::string m_password;
-};
+ public:
+ async_pool(EventLoop &ev) : base_class(ev) {}
+ virtual ~async_pool() {}
-template<typename EventLoop>
-class async_pool : public qtl::async_pool<async_pool<EventLoop>, EventLoop, async_connection>
-{
- typedef qtl::async_pool<async_pool<EventLoop>, EventLoop, async_connection> base_class;
-public:
- async_pool(EventLoop& ev) : base_class(ev) { }
- virtual ~async_pool() { }
-
- template<typename Handler>
- void new_connection(EventLoop& ev, Handler&& handler) throw()
- {
- async_connection* db = new async_connection;
- db->open(ev, [this, handler, db](const postgres::error& e) mutable {
+ template <typename Handler>
+ void new_connection(EventLoop &ev, Handler &&handler) throw()
+ {
+ async_connection *db = new async_connection;
+ db->open(ev, [this, handler, db](const postgres::error &e) mutable
+ {
if (e)
{
delete db;
db = nullptr;
}
- handler(e, db);
- }, m_params);
+ handler(e, db); }, m_params);
+ }
+
+ protected:
+ std::map<std::string, std::string> m_params;
+ };
+
}
-
-protected:
- std::map<std::string, std::string> m_params;
-};
-
-}
}
--
Gitblit v1.9.3