diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-16 13:19:56 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-16 13:19:56 +0000 |
commit | 6b913137275cacde9f938058f961d4cbb64f584b (patch) | |
tree | d6f9f2adf7e3efe5ddb27fcde03e519c1f52516c /libpqpp | |
parent | Basic clang tidy fixes (diff) | |
download | libdbpp-postgresql-6b913137275cacde9f938058f961d4cbb64f584b.tar.bz2 libdbpp-postgresql-6b913137275cacde9f938058f961d4cbb64f584b.tar.xz libdbpp-postgresql-6b913137275cacde9f938058f961d4cbb64f584b.zip |
More clang tidy fixes
Diffstat (limited to 'libpqpp')
-rw-r--r-- | libpqpp/pq-column.cpp | 3 | ||||
-rw-r--r-- | libpqpp/pq-connection.cpp | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp index 5e02015..eb5d291 100644 --- a/libpqpp/pq-column.cpp +++ b/libpqpp/pq-column.cpp @@ -72,7 +72,8 @@ PQ::Column::apply(DB::HandleField & h) const int days = 0, hours = 0, minutes = 0, seconds = 0, fractions = 0, flen1 = 0, flen2 = 0; const char * val = value(); if (sscanf(val, "%d %*[days] %d:%d:%d.%n%d%n", &days, &hours, &minutes, &seconds, &flen1, &fractions, &flen2) >= 4) { - h.interval(boost::posix_time::time_duration((24 * days) + hours, minutes, seconds, fractions * pow(10, boost::posix_time::time_res_traits::num_fractional_digits() + flen1 - flen2))); + h.interval(boost::posix_time::time_duration((24 * days) + hours, minutes, seconds, + fractions * (long)pow(10, boost::posix_time::time_res_traits::num_fractional_digits() + flen1 - flen2))); } else { h.interval(boost::posix_time::duration_from_string(value())); diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp index 3ec8991..4ebda84 100644 --- a/libpqpp/pq-connection.cpp +++ b/libpqpp/pq-connection.cpp @@ -31,9 +31,8 @@ PQ::Connection::Connection(const std::string & info) : conn(PQconnectdb(info.c_str())) { if (PQstatus(conn) != CONNECTION_OK) { - ConnectionError ce(conn); - PQfinish(conn); - throw ce; + auto dc = std::unique_ptr<PGconn, decltype(&PQfinish)>(conn, &PQfinish); + throw ConnectionError(dc.get()); } PQsetNoticeProcessor(conn, noNoticeProcessor, NULL); } |