Kea
1.9.9-git
|
Supports exchanging IPv4 leases with PostgreSQL. More...
Public Member Functions | |
PgSqlLease4Exchange () | |
Constructor. More... | |
Lease4Ptr | convertFromDatabase (const PgSqlResult &r, int row) |
Creates a Lease4 object from a given row in a result set. More... | |
void | createBindForSend (const Lease4Ptr &lease, PsqlBindArray &bind_array) |
Creates the bind array for sending Lease4 data to the database. More... | |
Public Member Functions inherited from isc::dhcp::PgSqlLeaseExchange | |
PgSqlLeaseExchange () | |
virtual | ~PgSqlLeaseExchange () |
Public Member Functions inherited from isc::db::PgSqlExchange | |
PgSqlExchange (const size_t num_columns=0) | |
Constructor. More... | |
virtual | ~PgSqlExchange () |
Destructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::db::PgSqlExchange | |
static void | convertFromBytea (const PgSqlResult &r, const int row, const size_t col, uint8_t *buffer, const size_t buffer_size, size_t &bytes_converted) |
Converts a column in a row in a result set to a binary bytes. More... | |
static time_t | convertFromDatabaseTime (const std::string &db_time_val) |
Converts time stamp from the database to a time_t. More... | |
static std::string | convertToDatabaseTime (const time_t input_time) |
Converts time_t value to a text representation in local time. More... | |
static std::string | convertToDatabaseTime (const time_t cltt, const uint32_t valid_lifetime) |
Converts lease expiration time to a text representation in local time. More... | |
static std::string | dumpRow (const PgSqlResult &r, int row) |
Diagnostic tool which dumps the Result row contents as a string. More... | |
static std::string | getColumnLabel (const PgSqlResult &r, const size_t col) |
Fetches the name of the column in a result set. More... | |
static void | getColumnValue (const PgSqlResult &r, const int row, const size_t col, std::string &value) |
Fetches text column value as a string. More... | |
static void | getColumnValue (const PgSqlResult &r, const int row, const size_t col, bool &value) |
Fetches boolean text ('t' or 'f') as a bool. More... | |
static void | getColumnValue (const PgSqlResult &r, const int row, const size_t col, uint8_t &value) |
Fetches an integer text column as a uint8_t. More... | |
template<typename T > | |
static void | getColumnValue (const PgSqlResult &r, const int row, const size_t col, T &value) |
Fetches a text column as the given value type. More... | |
static isc::asiolink::IOAddress | getIPv6Value (const PgSqlResult &r, const int row, const size_t col) |
Converts a column in a row in a result set into IPv6 address. More... | |
static const char * | getRawColumnValue (const PgSqlResult &r, const int row, const size_t col) |
Gets a pointer to the raw column value in a result set row. More... | |
static bool | isColumnNull (const PgSqlResult &r, const int row, const size_t col) |
Returns true if a column within a row is null. More... | |
Protected Attributes inherited from isc::dhcp::PgSqlLeaseExchange | |
std::string | addr_str_ |
Common Instance members used for binding and conversion. More... | |
size_t | hwaddr_length_ |
std::vector< uint8_t > | hwaddr_ |
uint8_t | hwaddr_buffer_ [HWAddr::MAX_HWADDR_LEN] |
uint32_t | valid_lifetime_ |
std::string | valid_lifetime_str_ |
time_t | expire_ |
std::string | expire_str_ |
uint32_t | subnet_id_ |
std::string | subnet_id_str_ |
time_t | cltt_ |
bool | fqdn_fwd_ |
bool | fqdn_rev_ |
std::string | hostname_ |
std::string | state_str_ |
std::string | user_context_ |
Protected Attributes inherited from isc::db::PgSqlExchange | |
std::vector< std::string > | columns_ |
Stores text labels for columns, currently only used for logging and errors. More... | |
Supports exchanging IPv4 leases with PostgreSQL.
Definition at line 412 of file pgsql_lease_mgr.cc.
|
inline |
Constructor.
Definition at line 436 of file pgsql_lease_mgr.cc.
|
inline |
Creates a Lease4 object from a given row in a result set.
r | result set containing one or rows from the Lease4 table |
row | row number within the result set from to create the Lease4 object. |
DbOperationError | if the lease cannot be created. |
Definition at line 548 of file pgsql_lease_mgr.cc.
References isc::dhcp::HTYPE_ETHER, isc_throw, and isc::Exception::what().
|
inline |
Creates the bind array for sending Lease4 data to the database.
Converts each Lease4 member into the appropriate form and adds it to the bind array. Note that the array additions must occur in the order the columns are specified in the SQL statement. By convention all columns in the table are explicitly listed in the SQL statement(s) in the same order as they occur in the table.
lease | Lease4 object that is to be written to the database | |
[out] | bind_array | array to populate with the lease data values |
DbOperationError | if bind_array cannot be populated. |
Definition at line 470 of file pgsql_lease_mgr.cc.
References isc::db::PsqlBindArray::add(), isc_throw, and isc::Exception::what().