From: Thomas Markwalder Date: Fri, 2 May 2014 15:42:56 +0000 (-0400) Subject: [3382] A bit more clean up. X-Git-Tag: trac3434_base~28^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=785eb5eea3f86fd95aef0a367f419cefa9663553;p=thirdparty%2Fkea.git [3382] A bit more clean up. I removed todos on regarding use of binary of text. I could not demonstrate any appreciable difference between the two forms and binary results require more manual conversion. Performance should be examined as a separte effort. --- diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index c5b9eae168..29651ba263 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -28,13 +28,13 @@ #include #include -// PostgreSQL errors should be tested based on the SQL state code. These are -// each state code is 5 decimal digits, the first two define the category of +// PostgreSQL errors should be tested based on the SQL state code. Each state +// code is 5 decimal, ASCII, digits, the first two define the category of // error, the last three are the specific error. PostgreSQL makes the state -// code as a char* of 5 ASCII digits. Macros for each code are defined in -// PostgreSQL's errorcodes.h, although they require a second macro, -// MAKE_SQLSTATE for completion. They deliberately do not define this -// this second macro in errorlogs.h, so callers can supply their own. +// code as a char[5]. Macros for each code are defined in PostgreSQL's +// errorcodes.h, although they require a second macro, MAKE_SQLSTATE for +// completion. PostgreSQL deliberately omits this macro from errocodes.h +// so callers can supply their own. #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) {ch1,ch2,ch3,ch4,ch5} #include const size_t STATECODE_LEN = 5; @@ -77,7 +77,7 @@ struct TaggedStatement { /// @brief Constants for PostgreSQL data types /// This are defined by PostreSQL in , but including /// this file is extrordinarily convoluted, so we'll use these to fill-in. -const size_t OID_NONE = 0; // PostgreSQL infers proper type +const size_t OID_NONE = 0; // PostgreSQL infers proper type const size_t OID_BOOL = 16; const size_t OID_BYTEA = 17; const size_t OID_INT8 = 20; // 8 byte int @@ -233,13 +233,6 @@ void PsqlBindArray::add(const std::vector& data) { formats_.push_back(BINARY_FMT); } -/// @todo not using yet -void PsqlBindArray::add(const uint32_t& value) { - values_.push_back(reinterpret_cast(&value)); - lengths_.push_back(sizeof(uint32_t)); - formats_.push_back(BINARY_FMT); -} - void PsqlBindArray::add(const bool& value) { add(value ? TRUE_STR : FALSE_STR); } @@ -576,9 +569,6 @@ public: /// all columns in the table are explicitly listed in the SQL statement(s) /// in the same order as they occur in the table. /// - /// @todo Bindings currently turn everything into strings, performance - /// could be improved by using binary-to-binary where possible. - /// /// @param lease Lease4 object that is to be written to the database /// @param[out] bind_array array to populate with the lease data values /// @@ -757,9 +747,6 @@ public: /// all columns in the table are explicitly listed in the SQL statement(s) /// in the same order as they occur in the table. /// - /// @todo Bindings currently turn everything into strings, performance - /// could be improved by using binary-to-binary where possible. - /// /// @param lease Lease6 object that is to be written to the database /// @param[out] bind_array array to populate with the lease data values ///