From 8a5dfc2ecbe613fa554281ed5c02111f17f97141 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Thu, 10 Apr 2025 11:57:37 +0500 Subject: [PATCH] Added comment --- include/PgSQL_Connection.h | 99 +++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/include/PgSQL_Connection.h b/include/PgSQL_Connection.h index e2271c4b3..470278628 100644 --- a/include/PgSQL_Connection.h +++ b/include/PgSQL_Connection.h @@ -152,53 +152,66 @@ static const std::unordered_map #define PG_EVENT_EXCEPT 0x04 #define PG_EVENT_TIMEOUT 0x08 + +/** + * @class PgSQL_Conn_Param + * @brief Stores PostgreSQL connection parameters sent by client. + * + * This class stores key-value pairs representing connection parameters + * for PostgreSQL connection. + * + */ class PgSQL_Conn_Param { public: - PgSQL_Conn_Param() {} - ~PgSQL_Conn_Param() {} - - bool set_value(const char* key, const char* val) { - if (key == nullptr || val == nullptr) return false; - connection_parameters[key] = val; - return true; - } - - inline - const char* get_value(PgSQL_Param_Name key) const { - return get_value(param_name[key]); - } - - const char* get_value(const char* key) const { - auto it = connection_parameters.find(key); - if (it != connection_parameters.end()) { - return it->second.c_str(); - } - return nullptr; - } - - bool remove_value(const char* key) { - auto it = connection_parameters.find(key); - if (it != connection_parameters.end()) { - connection_parameters.erase(it); - return true; - } - return false; - } - - inline - bool is_empty() const { - return connection_parameters.empty(); - } - - inline - void clear() { - connection_parameters.clear(); - } + PgSQL_Conn_Param() {} + ~PgSQL_Conn_Param() {} + + bool set_value(const char* key, const char* val) { + if (key == nullptr || val == nullptr) return false; + connection_parameters[key] = val; + return true; + } + + inline + const char* get_value(PgSQL_Param_Name key) const { + return get_value(param_name[key]); + } + + const char* get_value(const char* key) const { + auto it = connection_parameters.find(key); + if (it != connection_parameters.end()) { + return it->second.c_str(); + } + return nullptr; + } + + bool remove_value(const char* key) { + auto it = connection_parameters.find(key); + if (it != connection_parameters.end()) { + connection_parameters.erase(it); + return true; + } + return false; + } + + inline + bool is_empty() const { + return connection_parameters.empty(); + } + + inline + void clear() { + connection_parameters.clear(); + } private: - std::map connection_parameters; - friend class PgSQL_Session; - friend class PgSQL_Protocol; + /** + * @brief Stores the connection parameters as key-value pairs. + */ + std::map connection_parameters; + + friend class PgSQL_Session; + friend class PgSQL_Protocol; }; class PgSQL_Variable {