Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ else (MSVC)
option(SQLITECPP_USE_GCOV "USE GCov instrumentation." OFF)
if (SQLITECPP_USE_GCOV)
message (STATUS "Using GCov instrumentation")
add_compile_options (-coverage) # NOTE -fkeep-inline-functions would be useful but not working with current Google test and GCC 4.8
add_compile_options (-coverage)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage")
endif ()
endif (CMAKE_COMPILER_IS_GNUCXX)
Expand Down Expand Up @@ -198,6 +198,23 @@ if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Cla
set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fPIC")
endif (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))

option(SQLITECPP_USE_ASAN "Use Address Sanitizer." OFF)
if (SQLITECPP_USE_ASAN)
if ((CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 6) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
message (STATUS "Using Address Sanitizer")
set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
endif ()
endif ()
endif (SQLITECPP_USE_ASAN)

if (SQLITECPP_USE_GCOV)
# Prevent the compiler from removing the unused inline functions so that they get tracked as "non-covered"
set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fkeep-inline-functions -fkeep-static-functions")
endif ()

# Allow the library to be installed via "make install" and found with "find_package"
include(GNUInstallDirs)
install(TARGETS SQLiteCpp
Expand Down Expand Up @@ -227,18 +244,6 @@ install(FILES

## Build provided copy of SQLite3 C library ##

option(SQLITECPP_USE_ASAN "Use Address Sanitizer." OFF)
if (SQLITECPP_USE_ASAN)
if ((CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 6) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
message (STATUS "Using Address Sanitizer")
set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
endif ()
endif ()
endif (SQLITECPP_USE_ASAN)

option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)
if (SQLITECPP_INTERNAL_SQLITE)
# build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package
Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ cmake --build .

# Build and run unit-tests (ie 'make test')
ctest --output-on-failure

# And with Valgrind
#valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_example1
#valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_tests
18 changes: 9 additions & 9 deletions include/SQLiteCpp/Statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ class Statement
////////////////////////////////////////////////////////////////////////////

/// Return the UTF-8 SQL Query.
inline const std::string& getQuery() const
const std::string& getQuery() const
{
return mQuery;
}
Expand All @@ -618,17 +618,17 @@ class Statement
std::string getExpandedSQL();

/// Return the number of columns in the result set returned by the prepared statement
inline int getColumnCount() const
int getColumnCount() const
{
return mColumnCount;
}
/// true when a row has been fetched with executeStep()
inline bool hasRow() const
bool hasRow() const
{
return mbHasRow;
}
/// true when the last executeStep() had no more row to fetch
inline bool isDone() const
bool isDone() const
{
return mbDone;
}
Expand Down Expand Up @@ -667,13 +667,13 @@ class Statement
~Ptr();

/// Inline cast operator returning the pointer to SQLite Database Connection Handle
inline operator sqlite3*() const
operator sqlite3*() const
{
return mpSQLite;
}

/// Inline cast operator returning the pointer to SQLite Statement Object
inline operator sqlite3_stmt*() const
operator sqlite3_stmt*() const
{
return mpStmt;
}
Expand All @@ -696,7 +696,7 @@ class Statement
*
* @param[in] aRet SQLite return code to test against the SQLITE_OK expected value
*/
inline void check(const int aRet) const
void check(const int aRet) const
{
if (SQLite::OK != aRet)
{
Expand All @@ -707,7 +707,7 @@ class Statement
/**
* @brief Check if there is a row of result returned by executeStep(), else throw a SQLite::Exception.
*/
inline void checkRow() const
void checkRow() const
{
if (false == mbHasRow)
{
Expand All @@ -718,7 +718,7 @@ class Statement
/**
* @brief Check if there is a Column index is in the range of columns in the result.
*/
inline void checkIndex(const int aIndex) const
void checkIndex(const int aIndex) const
{
if ((aIndex < 0) || (aIndex >= mColumnCount))
{
Expand Down