with the specified address to the PostgreSQL backend database.
% DHCPSRV_PGSQL_DEALLOC_ERROR An error occured deallocating SQL statements while closing the PostgreSQL lease database: %1
-This is an error message issued when a DHCP server (either V4 or V6) exprienced
+This is an error message issued when a DHCP server (either V4 or V6) experienced
and error freeing database SQL resources as part of closing its connection to
- the Postgresql database. The connection is closed as part of normal server
+the Postgresql database. The connection is closed as part of normal server
shutdown. This error is most likely a programmatic issue that is highly
unlikely to occur or negatively impact server operation.
namespace {
-// Maximum number of parameters used in any signle query
+// Maximum number of parameters used in any single query
const size_t MAX_PARAMETERS_IN_QUERY = 13;
-// Defines a single query
+/// @brief Defines a single query
struct TaggedStatement {
/// Query index
class PgSqlLeaseExchange {
protected:
- /// Converts time_t structure to a text representation in local time.
+ /// @brief Converts time_t structure to a text representation in local time.
///
/// The format of the output string is "%Y-%m-%d %H:%M:%S". Database
/// table columns using this value should be typed as TIMESTAMP WITH
return (std::string(buffer));
}
- /// Converts time stamp from the database to a time_t
+ /// @brief Converts time stamp from the database to a time_t
+ ///
/// @param db_time_val timestamp to be converted. This value
/// is expected to be the number of seconds since the epoch
/// expressed as base-10 integer string.
+ /// @return Converted timestamp as time_t value.
time_t convertFromDatabaseTime(const std::string& db_time_val) {
// Convert string time value to time_t
try {
}
}
- /// Converts Postgres text boolean representations to bool
+ /// @brief Converts Postgres text boolean representations to bool
///
/// Allowed values are "t" or "f", or "" which is false.
// Any other will throw.
/// @brief Represents a single Lease4 exchange
class PgSqlLease4Exchange : public PgSqlLeaseExchange {
+private:
+ /// @brief Number of columns in the table holding DHCPv4 leases.
static const size_t LEASE_COLUMNS = 9;
+
public:
- /// Default constructor
+ /// @brief Default constructor
PgSqlLease4Exchange() : addr4_(0), hwaddr_length_(0), client_id_length_(0) {
memset(hwaddr_buffer_, 0, sizeof(hwaddr_buffer_));
memset(client_id_buffer_, 0, sizeof(client_id_buffer_));
};
class PgSqlLease6Exchange : public PgSqlLeaseExchange {
+private:
static const size_t LEASE_COLUMNS = 12;
+
public:
PgSqlLease6Exchange() : duid_length_(0) {
memset(duid_buffer_, 0, sizeof(duid_buffer_));
sname= getParameter("name");
dbconnparameters += " dbname = '" + sname + "'";
} catch(...) {
- // No database name. Throw a "NoName" exception
- isc_throw(NoDatabaseName, "must specified a name for the database");
+ // No database name. Throw a "NoDatabaseName" exception
+ isc_throw(NoDatabaseName, "must specify a name for the database");
}
conn_ = PQconnectdb(dbconnparameters.c_str());