![]() |
Kea
2.5.3
|
Base PgSql derivation of the statistical lease data query. More...
Public Member Functions | |
PgSqlLeaseStatsQuery (PgSqlConnection &conn, PgSqlTaggedStatement &statement, const bool fetch_type, const bool fetch_pool=false) | |
Constructor to query for all subnets' stats. More... | |
PgSqlLeaseStatsQuery (PgSqlConnection &conn, PgSqlTaggedStatement &statement, const bool fetch_type, const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) | |
Constructor to query for the stats for a range of subnets. More... | |
PgSqlLeaseStatsQuery (PgSqlConnection &conn, PgSqlTaggedStatement &statement, const bool fetch_type, const SubnetID &subnet_id) | |
Constructor to query for a single subnet's stats. More... | |
virtual | ~PgSqlLeaseStatsQuery () |
Destructor. More... | |
bool | getNextRow (LeaseStatsRow &row) |
Fetches the next row in the result set. More... | |
void | start () |
Creates the lease statistical data result set. More... | |
![]() | |
LeaseStatsQuery (const SelectMode &select_mode=ALL_SUBNETS) | |
Constructor to query statistics for all subnets. More... | |
LeaseStatsQuery (const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) | |
Constructor to query for the stats for a range of subnets. More... | |
LeaseStatsQuery (const SubnetID &subnet_id) | |
Constructor to query for a single subnet's stats. More... | |
virtual | ~LeaseStatsQuery () |
virtual destructor More... | |
SubnetID | getFirstSubnetID () const |
Returns the value of first subnet ID specified (or zero) More... | |
SubnetID | getLastSubnetID () const |
Returns the value of last subnet ID specified (or zero) More... | |
SelectMode | getSelectMode () const |
Returns the selection criteria mode The value returned is based upon the constructor variant used and it indicates which query variant will be executed. More... | |
Protected Attributes | |
PgSqlConnection & | conn_ |
Database connection to use to execute the query. More... | |
bool | fetch_pool_ |
Indicates if query requires pool data. More... | |
bool | fetch_type_ |
Indicates if query supplies lease type. More... | |
uint32_t | next_row_ |
Index of the next row to fetch. More... | |
boost::shared_ptr< PgSqlResult > | result_set_ |
The result set returned by Postgres. More... | |
PgSqlTaggedStatement & | statement_ |
The query's prepared statement. More... | |
![]() | |
SubnetID | first_subnet_id_ |
First (or only) subnet_id in the selection criteria. More... | |
SubnetID | last_subnet_id_ |
Last subnet_id in the selection criteria when a range is given. More... | |
Static Protected Attributes | |
static bool | negative_count_ = false |
Received negative state count showing a problem. More... | |
Additional Inherited Members | |
![]() | |
enum | SelectMode { ALL_SUBNETS , SINGLE_SUBNET , SUBNET_RANGE , ALL_SUBNET_POOLS } |
Defines the types of selection criteria supported. More... | |
Base PgSql derivation of the statistical lease data query.
This class provides the functionality such as results storage and row fetching common to fulfilling the statistical lease data query.
Definition at line 1376 of file pgsql_lease_mgr.cc.
|
inline |
Constructor to query for all subnets' stats.
The query created will return statistics for all subnets
conn | A open connection to the database housing the lease data |
statement | The lease data SQL prepared statement to execute |
fetch_type | Indicates whether or not lease_type should be fetched from the result set |
fetch_pool | Indicates if query requires pool data |
Definition at line 1388 of file pgsql_lease_mgr.cc.
|
inline |
Constructor to query for a single subnet's stats.
The query created will return statistics for a single subnet
conn | A open connection to the database housing the lease data |
statement | The lease data SQL prepared statement to execute |
fetch_type | Indicates if query supplies lease type |
subnet_id | id of the subnet for which stats are desired |
Definition at line 1402 of file pgsql_lease_mgr.cc.
|
inline |
Constructor to query for the stats for a range of subnets.
The query created will return statistics for the inclusive range of subnets described by first and last subnet IDs.
conn | A open connection to the database housing the lease data |
statement | The lease data SQL prepared statement to execute |
fetch_type | Indicates if query supplies lease type |
first_subnet_id | first subnet in the range of subnets |
last_subnet_id | last subnet in the range of subnets |
Definition at line 1418 of file pgsql_lease_mgr.cc.
|
inlinevirtual |
Destructor.
Definition at line 1426 of file pgsql_lease_mgr.cc.
|
inlinevirtual |
Fetches the next row in the result set.
Once the internal result set has been populated by invoking the the start() method, this method is used to iterate over the result set rows. Once the last row has been fetched, subsequent calls will return false.
Checks against negative values for the state count and logs once a warning message.
row | Storage for the fetched row |
Reimplemented from isc::dhcp::LeaseStatsQuery.
Definition at line 1479 of file pgsql_lease_mgr.cc.
References isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_PGSQL_NEGATIVE_LEASES_STAT, isc::dhcp::LeaseStatsRow::lease_state_, isc::dhcp::LeaseStatsRow::lease_type_, LOG_WARN, isc::dhcp::LeaseStatsRow::pool_id_, isc::dhcp::LeaseStatsRow::state_count_, and isc::dhcp::LeaseStatsRow::subnet_id_.
|
inlinevirtual |
Creates the lease statistical data result set.
The result set is populated by executing a prepared SQL query against the database fetches the lease count per lease state per (per least type - v6 only) per subnet id.
Depending upon the selection mode, the query will have either no parameters (for all subnets), a subnet id for a single subnet, or a first and last subnet id for a subnet range.
Reimplemented from isc::dhcp::LeaseStatsQuery.
Definition at line 1437 of file pgsql_lease_mgr.cc.
References isc::db::PsqlBindArray::addTempString(), isc::db::PsqlBindArray::formats_, isc::db::PsqlBindArray::lengths_, isc::db::PsqlBindArray::size(), and isc::db::PsqlBindArray::values_.
|
protected |
Database connection to use to execute the query.
Definition at line 1536 of file pgsql_lease_mgr.cc.
|
protected |
Indicates if query requires pool data.
Definition at line 1551 of file pgsql_lease_mgr.cc.
|
protected |
Indicates if query supplies lease type.
Definition at line 1548 of file pgsql_lease_mgr.cc.
|
staticprotected |
Received negative state count showing a problem.
Definition at line 1554 of file pgsql_lease_mgr.cc.
|
protected |
Index of the next row to fetch.
Definition at line 1545 of file pgsql_lease_mgr.cc.
|
protected |
The result set returned by Postgres.
Definition at line 1542 of file pgsql_lease_mgr.cc.
|
protected |
The query's prepared statement.
Definition at line 1539 of file pgsql_lease_mgr.cc.