mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-07 11:16:11 -04:00
Now working with example
This commit is contained in:
parent
f2253419b2
commit
14cba69a33
@ -17,16 +17,6 @@ endif ()
|
||||
message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
message("defining SQLITECPP_COMPILE_DLL")
|
||||
add_definitions("-DSQLITECPP_COMPILE_DLL")
|
||||
if(SQLITECPP_DLL_EXPORT)
|
||||
add_definitions("-DSQLITECPP_DLL_EXPORT")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message (STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
message (STATUS "Project version: ${PROJECT_VERSION}")
|
||||
|
||||
@ -223,6 +213,13 @@ if (SQLITE_USE_LEGACY_STRUCT)
|
||||
target_compile_definitions(SQLiteCpp PUBLIC SQLITE_USE_LEGACY_STRUCT)
|
||||
endif (SQLITE_USE_LEGACY_STRUCT)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
add_definitions("-DSQLITECPP_COMPILE_DLL")
|
||||
target_compile_definitions(SQLiteCpp PRIVATE "SQLITECPP_DLL_EXPORT=1")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(SQLITE_OMIT_LOAD_EXTENSION "Enable omit load extension" OFF)
|
||||
if (SQLITE_OMIT_LOAD_EXTENSION)
|
||||
# Enable the user definition of load_extension().
|
||||
@ -412,8 +409,14 @@ endif (SQLITECPP_RUN_DOXYGEN)
|
||||
|
||||
option(SQLITECPP_BUILD_EXAMPLES "Build examples." OFF)
|
||||
if (SQLITECPP_BUILD_EXAMPLES)
|
||||
|
||||
# add the basic example executable
|
||||
add_executable(SQLiteCpp_example1 ${SQLITECPP_EXAMPLES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
target_compile_definitions(SQLiteCpp_example1 PRIVATE "SQLITECPP_DLL_EXPORT=0")
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(SQLiteCpp_example1 SQLiteCpp)
|
||||
if (MSYS OR MINGW)
|
||||
target_link_libraries(SQLiteCpp_example1 ssp)
|
||||
|
@ -107,15 +107,15 @@ DLL_API extern const int OPEN_PRIVATECACHE; // SQLITE_OPEN_PRIVATECACHE
|
||||
DLL_API extern const int OPEN_NOFOLLOW; // SQLITE_OPEN_NOFOLLOW
|
||||
|
||||
|
||||
extern const int OK; ///< SQLITE_OK (used by check() bellow)
|
||||
DLL_API extern const int OK; ///< SQLITE_OK (used by check() bellow)
|
||||
|
||||
extern const char* const VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time
|
||||
extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time
|
||||
DLL_API extern const char* const VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time
|
||||
DLL_API extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time
|
||||
|
||||
/// Return SQLite version string using runtime call to the compiled library
|
||||
const char* getLibVersion() noexcept;
|
||||
DLL_API const char* getLibVersion() noexcept;
|
||||
/// Return SQLite version number using runtime call to the compiled library
|
||||
int getLibVersionNumber() noexcept;
|
||||
DLL_API int getLibVersionNumber() noexcept;
|
||||
|
||||
// Public structure for representing all fields contained within the SQLite header.
|
||||
// Official documentation for fields: https://www.sqlite.org/fileformat.html#the_database_header
|
||||
@ -266,7 +266,7 @@ public:
|
||||
// Deleter functor to use with smart pointers to close the SQLite database connection in an RAII fashion.
|
||||
struct Deleter
|
||||
{
|
||||
void operator()(sqlite3* apSQLite);
|
||||
DLL_API void operator()(sqlite3* apSQLite);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/* Windows DLL export/import */
|
||||
#if defined(WIN32) && defined(SQLITECPP_COMPILE_DLL)
|
||||
#if defined(SQLITECPP_DLL_EXPORT)
|
||||
#if SQLITECPP_DLL_EXPORT
|
||||
#define DLL_API __declspec(dllexport)
|
||||
#pragma message("Exporting symbols")
|
||||
#else
|
||||
@ -29,3 +29,8 @@
|
||||
#else
|
||||
#define DLL_API
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && defined(SQLITECPP_COMPILE_DLL)
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ namespace SQLite
|
||||
class Database;
|
||||
class Column;
|
||||
|
||||
extern const int OK; ///< SQLITE_OK
|
||||
DLL_API extern const int OK; ///< SQLITE_OK
|
||||
|
||||
/**
|
||||
* @brief RAII encapsulation of a prepared SQLite Statement.
|
||||
|
@ -13,13 +13,7 @@ add_library(sqlite3
|
||||
|
||||
if(WIN32)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(SQLITECPP_DLL_EXPORT)
|
||||
message("Adding __declspec(dllexport)")
|
||||
add_definitions("-DSQLITE_API=__declspec(dllexport)")
|
||||
else()
|
||||
message("Adding __declspec(dllimport)")
|
||||
add_definitions("-DSQLITE_API=__declspec(dllimport)")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -18,11 +18,11 @@
|
||||
namespace SQLite
|
||||
{
|
||||
|
||||
const int INTEGER = SQLITE_INTEGER;
|
||||
const int FLOAT = SQLITE_FLOAT;
|
||||
const int TEXT = SQLITE_TEXT;
|
||||
const int BLOB = SQLITE_BLOB;
|
||||
const int Null = SQLITE_NULL;
|
||||
DLL_API const int INTEGER = SQLITE_INTEGER;
|
||||
DLL_API const int FLOAT = SQLITE_FLOAT;
|
||||
DLL_API const int TEXT = SQLITE_TEXT;
|
||||
DLL_API const int BLOB = SQLITE_BLOB;
|
||||
DLL_API const int Null = SQLITE_NULL;
|
||||
|
||||
|
||||
// Encapsulation of a Column in a row of the result pointed by the prepared Statement.
|
||||
|
@ -23,29 +23,28 @@
|
||||
#define SQLITE_DETERMINISTIC 0x800
|
||||
#endif // SQLITE_DETERMINISTIC
|
||||
|
||||
|
||||
namespace SQLite
|
||||
{
|
||||
|
||||
const int OK = SQLITE_OK;
|
||||
const int OPEN_READONLY = SQLITE_OPEN_READONLY;
|
||||
const int OPEN_READWRITE = SQLITE_OPEN_READWRITE;
|
||||
const int OPEN_CREATE = SQLITE_OPEN_CREATE;
|
||||
const int OPEN_URI = SQLITE_OPEN_URI;
|
||||
const int OPEN_MEMORY = SQLITE_OPEN_MEMORY;
|
||||
const int OPEN_NOMUTEX = SQLITE_OPEN_NOMUTEX;
|
||||
const int OPEN_FULLMUTEX = SQLITE_OPEN_FULLMUTEX;
|
||||
const int OPEN_SHAREDCACHE = SQLITE_OPEN_SHAREDCACHE;
|
||||
const int OPEN_PRIVATECACHE = SQLITE_OPEN_PRIVATECACHE;
|
||||
DLL_API const int OK = SQLITE_OK;
|
||||
DLL_API const int OPEN_READONLY = SQLITE_OPEN_READONLY;
|
||||
DLL_API const int OPEN_READWRITE = SQLITE_OPEN_READWRITE;
|
||||
DLL_API const int OPEN_CREATE = SQLITE_OPEN_CREATE;
|
||||
DLL_API const int OPEN_URI = SQLITE_OPEN_URI;
|
||||
DLL_API const int OPEN_MEMORY = SQLITE_OPEN_MEMORY;
|
||||
DLL_API const int OPEN_NOMUTEX = SQLITE_OPEN_NOMUTEX;
|
||||
DLL_API const int OPEN_FULLMUTEX = SQLITE_OPEN_FULLMUTEX;
|
||||
DLL_API const int OPEN_SHAREDCACHE = SQLITE_OPEN_SHAREDCACHE;
|
||||
DLL_API const int OPEN_PRIVATECACHE = SQLITE_OPEN_PRIVATECACHE;
|
||||
// check if sqlite version is >= 3.31.0 and SQLITE_OPEN_NOFOLLOW is defined
|
||||
#if SQLITE_VERSION_NUMBER >= 3031000 && defined(SQLITE_OPEN_NOFOLLOW)
|
||||
const int OPEN_NOFOLLOW = SQLITE_OPEN_NOFOLLOW;
|
||||
DLL_API const int OPEN_NOFOLLOW = SQLITE_OPEN_NOFOLLOW;
|
||||
#else
|
||||
const int OPEN_NOFOLLOW = 0;
|
||||
DLL_API const int OPEN_NOFOLLOW = 0;
|
||||
#endif
|
||||
|
||||
const char* const VERSION = SQLITE_VERSION;
|
||||
const int VERSION_NUMBER = SQLITE_VERSION_NUMBER;
|
||||
DLL_API const char* const VERSION = SQLITE_VERSION;
|
||||
DLL_API const int VERSION_NUMBER = SQLITE_VERSION_NUMBER;
|
||||
|
||||
// Return SQLite version string using runtime call to the compiled library
|
||||
const char* getLibVersion() noexcept
|
||||
|
Loading…
x
Reference in New Issue
Block a user