From 6a7186233ee68408988c209a4733c8ba77e16ea2 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Mon, 19 Oct 2015 07:17:10 -0700 Subject: [PATCH] [master] Do not use temporary variables to bind to PostgreSQL queries. This change has been reviewed and approved on jabber. --- src/lib/dhcpsrv/pgsql_lease_mgr.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index 3e3381ea5b..f655fcaf55 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -1470,16 +1470,19 @@ PgSqlLeaseMgr::getExpiredLeasesCommon(LeaseCollection& expired_leases, PsqlBindArray bind_array; // Exclude reclaimed leases. - bind_array.add(boost::lexical_cast(Lease::STATE_EXPIRED_RECLAIMED)); + std::string state_str = boost::lexical_cast(Lease::STATE_EXPIRED_RECLAIMED); + bind_array.add(state_str); // Expiration timestamp. - bind_array.add(PgSqlLeaseExchange::convertToDatabaseTime(time(NULL))); + std::string timestamp_str = PgSqlLeaseExchange::convertToDatabaseTime(time(NULL)); + bind_array.add(timestamp_str); // If the number of leases is 0, we will return all leases. This is // achieved by setting the limit to a very high value. uint32_t limit = max_leases > 0 ? static_cast(max_leases) : std::numeric_limits::max(); - bind_array.add(boost::lexical_cast(limit)); + std::string limit_str = boost::lexical_cast(limit); + bind_array.add(limit_str); // Retrieve leases from the database. getLeaseCollection(statement_index, bind_array, expired_leases); -- 2.47.2