Renamed Column::getName() to Column::getOriginName()

This commit is contained in:
Sébastien Rombauts 2013-11-22 06:56:03 +01:00
parent ef6fac6b71
commit 05a37fd64c
5 changed files with 17 additions and 12 deletions

View File

@ -30,4 +30,8 @@ Version 0.5.0 - March 9 2013
Added bind() for binary blob data Added bind() for binary blob data
Version 0.5.1 - April 7 2013 Version 0.5.1 - April 7 2013
Added getName() Added Collumn::getName()
TODO 0.6.0 - ?? 2013
Renamed Collumn::getName() to Collumn::getOriginName()

View File

@ -27,7 +27,7 @@ if (MSVC)
add_definitions (/D_CRT_SECURE_NO_WARNINGS) add_definitions (/D_CRT_SECURE_NO_WARNINGS)
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# GCC flags # 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 () endif ()
# add a cppcheck target to the "all" target # add a cppcheck target to the "all" target

View File

@ -113,11 +113,12 @@ int main (void)
static bool bFirst = true; static bool bFirst = true;
if (bFirst) if (bFirst)
{ {
// Show how to get the name of a column. // 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. // Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be
std::string name0 = query.getColumn(0).getName(); // also defined at compile times of the SQLite library itself.
std::string name1 = query.getColumn(1).getName(); std::string name0 = query.getColumn(0).getOriginName();
std::string name2 = query.getColumn(2).getName(); 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"; std::cout << "table 'test' [\"" << name0.c_str() << "\", \"" << name1.c_str() << "\", \"" << name2.c_str() << "\"]\n";
bFirst = false; bFirst = false;
} }

View File

@ -31,8 +31,8 @@ Column::~Column(void) throw() // nothrow
} }
#ifdef SQLITE_ENABLE_COLUMN_METADATA #ifdef SQLITE_ENABLE_COLUMN_METADATA
// Return the name of the column // Return the name of the table column that is the origin of this result column
const char * Column::getName(void) const throw() // nothrow const char * Column::getOriginName(void) const throw() // nothrow
{ {
return sqlite3_column_origin_name(mStmtPtr, mIndex); return sqlite3_column_origin_name(mStmtPtr, mIndex);
} }

View File

@ -53,13 +53,13 @@ public:
#ifdef SQLITE_ENABLE_COLUMN_METADATA #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 : * 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. * - and also when compiling this wrapper.
*/ */
const char* getName (void) const throw(); // nothrow const char* getOriginName (void) const throw(); // nothrow
#endif #endif
/// @brief Return the integer value of the column. /// @brief Return the integer value of the column.