From 05a37fd64c771ce97d3e85838bed164162860b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Fri, 22 Nov 2013 06:56:03 +0100 Subject: [PATCH] Renamed Column::getName() to Column::getOriginName() --- CHANGELOG.txt | 6 +++++- CMakeLists.txt | 2 +- examples/example1/main.cpp | 11 ++++++----- src/Column.cpp | 4 ++-- src/Column.h | 6 +++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 313e865..66cba34 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -30,4 +30,8 @@ Version 0.5.0 - March 9 2013 Added bind() for binary blob data Version 0.5.1 - April 7 2013 - Added getName() \ No newline at end of file + Added Collumn::getName() + +TODO 0.6.0 - ?? 2013 + Renamed Collumn::getName() to Collumn::getOriginName() + diff --git a/CMakeLists.txt b/CMakeLists.txt index a8390d1..4950b28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ if (MSVC) add_definitions (/D_CRT_SECURE_NO_WARNINGS) elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # GCC flags - add_definitions (-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn) + add_definitions (-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const) endif () # add a cppcheck target to the "all" target diff --git a/examples/example1/main.cpp b/examples/example1/main.cpp index 1e1745a..93165e4 100644 --- a/examples/example1/main.cpp +++ b/examples/example1/main.cpp @@ -113,11 +113,12 @@ int main (void) static bool bFirst = true; if (bFirst) { - // Show how to get the name of a column. - // Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be also defined at compile times of the SQLite library. - std::string name0 = query.getColumn(0).getName(); - std::string name1 = query.getColumn(1).getName(); - std::string name2 = query.getColumn(2).getName(); + // Show how to get the name of the table column from which this particular result column come from. + // Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be + // also defined at compile times of the SQLite library itself. + std::string name0 = query.getColumn(0).getOriginName(); + std::string name1 = query.getColumn(1).getOriginName(); + std::string name2 = query.getColumn(2).getOriginName(); std::cout << "table 'test' [\"" << name0.c_str() << "\", \"" << name1.c_str() << "\", \"" << name2.c_str() << "\"]\n"; bFirst = false; } diff --git a/src/Column.cpp b/src/Column.cpp index 573b6c7..9cd6eca 100644 --- a/src/Column.cpp +++ b/src/Column.cpp @@ -31,8 +31,8 @@ Column::~Column(void) throw() // nothrow } #ifdef SQLITE_ENABLE_COLUMN_METADATA -// Return the name of the column -const char * Column::getName(void) const throw() // nothrow +// Return the name of the table column that is the origin of this result column +const char * Column::getOriginName(void) const throw() // nothrow { return sqlite3_column_origin_name(mStmtPtr, mIndex); } diff --git a/src/Column.h b/src/Column.h index b46779c..2176030 100644 --- a/src/Column.h +++ b/src/Column.h @@ -53,13 +53,13 @@ public: #ifdef SQLITE_ENABLE_COLUMN_METADATA /** - * @brief Return a pointer to the column name + * @brief Return a pointer to the table column name that is the origin of this result column * * Require definition of the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro : - * - for compilation of the SQLite library, + * - when building the SQLite library itself (which is the case for the Debian libsqlite3 binary for instance), * - and also when compiling this wrapper. */ - const char* getName (void) const throw(); // nothrow + const char* getOriginName (void) const throw(); // nothrow #endif /// @brief Return the integer value of the column.