mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Changed Column::getText() to return empty string "" by default instead of NULL pointer (to handle std::string conversion)
- Fix issue #17
This commit is contained in:
parent
b0e9104047
commit
ff946bd295
@ -40,4 +40,7 @@ Version 0.7.0 - January 9 2014
|
||||
Added a new Database::createFunction() API
|
||||
Added std::string version of existing APIs
|
||||
Improved CMake with more build options and Doxygen auto-detection
|
||||
|
||||
|
||||
Version 0.8.0 - Februrary 26 2014
|
||||
Changed Column::getText() to return empty string "" by default instead of NULL pointer (to handle std::string conversion)
|
||||
|
||||
|
2
Doxyfile
2
Doxyfile
@ -32,7 +32,7 @@ PROJECT_NAME = SQLiteC++
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.7.0
|
||||
PROJECT_NUMBER = 0.8.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Demonstrate how-to use the SQLite++ wrapper
|
||||
*
|
||||
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
* Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
@ -118,7 +118,7 @@ int main (void)
|
||||
std::string name2 = query.getColumn(2).getName();
|
||||
std::cout << "aliased result [\"" << name0.c_str() << "\", \"" << name1.c_str() << "\", \"" << name2.c_str() << "\"]\n";
|
||||
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||
// Show how to get origin names of the table columns from which thoses result columns come from.
|
||||
// Show how to get origin names of the table columns from which theses result columns come from.
|
||||
// Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be
|
||||
// also defined at compile times of the SQLite library itself.
|
||||
name0 = query.getColumn(0).getOriginName();
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @ingroup SQLiteCpp
|
||||
* @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement.
|
||||
*
|
||||
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
* Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
@ -63,10 +63,10 @@ double Column::getDouble(void) const noexcept // nothrow
|
||||
}
|
||||
|
||||
// Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0
|
||||
const char* Column::getText(void) const noexcept // nothrow
|
||||
const char* Column::getText(const char* apDefaultValue /* = "" */) const noexcept // nothrow
|
||||
{
|
||||
// TODO what if NULL !?
|
||||
return (const char*)sqlite3_column_text(mStmtPtr, mIndex);
|
||||
const char* pText = (const char*)sqlite3_column_text(mStmtPtr, mIndex);
|
||||
return (pText?pText:apDefaultValue);
|
||||
}
|
||||
|
||||
// Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @ingroup SQLiteCpp
|
||||
* @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement.
|
||||
*
|
||||
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
* Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
@ -35,6 +35,8 @@ namespace SQLite
|
||||
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||
* because of the way it shares the underling SQLite precompiled statement
|
||||
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||
*
|
||||
* @todo inline all simple getters
|
||||
*/
|
||||
class Column
|
||||
{
|
||||
@ -80,7 +82,7 @@ public:
|
||||
* @warning The value pointed at is only valid while the statement is valid (ie. not finalized),
|
||||
* thus you must copy it before using it beyond its scope (to a std::string for instance).
|
||||
*/
|
||||
const char* getText (void) const noexcept; // nothrow
|
||||
const char* getText (const char* apDefaultValue = "") const noexcept; // nothrow
|
||||
/**
|
||||
* @brief Return a pointer to the binary blob value of the column.
|
||||
*
|
||||
@ -184,7 +186,6 @@ public:
|
||||
/// Inline cast operator to std::string
|
||||
inline operator const std::string() const
|
||||
{
|
||||
// TODO what if NULL !?
|
||||
return getText();
|
||||
}
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Include this main header file in your project to gain access to all functionality provided by the wrapper.
|
||||
*
|
||||
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
* Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
@ -38,5 +38,5 @@
|
||||
* with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
|
||||
* numbers used in [SQLITECPP_VERSION].
|
||||
*/
|
||||
#define SQLITECPP_VERSION "0.7.0"
|
||||
#define SQLITECPP_VERSION_NUMBER 0006000
|
||||
#define SQLITECPP_VERSION "0.8.0"
|
||||
#define SQLITECPP_VERSION_NUMBER 0008000
|
||||
|
Loading…
x
Reference in New Issue
Block a user