From ee7ac58694c16cdd922a6eeddbe1a2eba0da7b4e Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 29 Jan 2005 19:41:34 +0000 Subject: initial commit. --- (limited to 'include/konforka/pqxx_pile.h') diff --git a/include/konforka/pqxx_pile.h b/include/konforka/pqxx_pile.h new file mode 100644 index 0000000..fdfaed6 --- a/dev/null +++ b/include/konforka/pqxx_pile.h @@ -0,0 +1,59 @@ +#ifndef __KONFORKA_PQXX_PILE_H +#define __KONFORKA_PQXX_PILE_H + +#include +#include + +/** + * @file + * @brief libpqxx-based postgresql connections pile. + */ + +namespace konforka { + + /** + * @brief the base for pqxx-based connection classes. + * + * @param pqxxc_t the type of libpqxx connection (pqxx::connection, + * pqxx::lazyconnection or pqxx::asyncconnection). + */ + template + class pqxx_piled_connection_base : public resource_pile_base > { + public: + /** + * @brief the constractor based on connection info. + * + * @param ci connection info string. + */ + pqxx_piled_connection_base(const string& ci) + : resource_pile_base >(ci) { } + ~pqxx_piled_connection_base() { this->drop(); } + + /** + * @brief cast the object to the reference to the corresponding + * libpqxx type. + */ + operator pqxxc_t&(void) { return *this->get_content(); } + /** + * @brief cast the object to the const reference to the + * corresponding libpqxx type. + */ + operator const pqxxc_t&(void) const { return *this->get_content(); } + }; + + /** + * @brief the implementation for piling pqxx::connection objects. + */ + typedef pqxx_piled_connection_base pqxx_piled_connection; + /** + * @brief the implementation for piling pqxx::lazyconnection objects. + */ + typedef pqxx_piled_connection_base pqxx_piled_lazy_connection; + /** + * @brief the implementation for piling pqxx::asyncconnection objects. + */ + typedef pqxx_piled_connection_base pqxx_piled_async_connection; +} + +#endif /* __KONFORKA_PQXX_PILE_H */ +/* vim:set ft=cpp: */ -- cgit v0.9.0.2