diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-06 02:40:56 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-08 19:33:31 +0000 |
commit | 41b302488e82097c3043d71b405e7ba930151a76 (patch) | |
tree | bd048b5c887690c826b2b72d806932b849a8723f /libpqpp/pq-column.cpp | |
parent | Use SQL hash for prepared statement names, increases reuse and avoids random ... (diff) | |
download | libdbpp-postgresql-41b302488e82097c3043d71b405e7ba930151a76.tar.bz2 libdbpp-postgresql-41b302488e82097c3043d71b405e7ba930151a76.tar.xz libdbpp-postgresql-41b302488e82097c3043d71b405e7ba930151a76.zip |
Minor updates/tweaks to increase test coverage
Diffstat (limited to 'libpqpp/pq-column.cpp')
-rw-r--r-- | libpqpp/pq-column.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp index a073f26..bb09c45 100644 --- a/libpqpp/pq-column.cpp +++ b/libpqpp/pq-column.cpp @@ -50,10 +50,7 @@ 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 = PQgetvalue(sc->execRes, sc->tuple, colNo); - 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))); - } - else if (sscanf(val, "%d day %d:%d:%d.%n%d%n", &days, &hours, &minutes, &seconds, &flen1, &fractions, &flen2) >= 4) { + 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))); } else { |