-
-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GRDB_SQLITE_INLINE and GRDB_PERFORMANCE_TESTS envrionment variabl…
…es to control whether to use the new GRDBSQLiteDynamic module and enable performance tests
- Loading branch information
Showing
7 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module GRDBSQLite [system] { | ||
header "shim.h" | ||
link "sqlite3" | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <sqlite3.h> | ||
|
||
typedef void(*_errorLogCallback)(void *pArg, int iErrCode, const char *zMsg); | ||
|
||
/// Wrapper around sqlite3_config(SQLITE_CONFIG_LOG, ...) which is a variadic | ||
/// function that can't be used from Swift. | ||
static inline void _registerErrorLogCallback(_errorLogCallback callback) { | ||
sqlite3_config(SQLITE_CONFIG_LOG, callback, 0); | ||
} | ||
|
||
#if SQLITE_VERSION_NUMBER >= 3029000 | ||
/// Wrapper around sqlite3_db_config() which is a variadic function that can't | ||
/// be used from Swift. | ||
static inline void _disableDoubleQuotedStringLiterals(sqlite3 *db) { | ||
sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 0, (void *)0); | ||
sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 0, (void *)0); | ||
} | ||
|
||
/// Wrapper around sqlite3_db_config() which is a variadic function that can't | ||
/// be used from Swift. | ||
static inline void _enableDoubleQuotedStringLiterals(sqlite3 *db) { | ||
sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 1, (void *)0); | ||
sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 1, (void *)0); | ||
} | ||
#else | ||
static inline void _disableDoubleQuotedStringLiterals(sqlite3 *db) { } | ||
static inline void _enableDoubleQuotedStringLiterals(sqlite3 *db) { } | ||
#endif | ||
|
||
// Expose APIs that are missing from system <sqlite3.h> | ||
#ifdef GRDB_SQLITE_ENABLE_PREUPDATE_HOOK | ||
SQLITE_API void *sqlite3_preupdate_hook( | ||
sqlite3 *db, | ||
void(*xPreUpdate)( | ||
void *pCtx, /* Copy of third arg to preupdate_hook() */ | ||
sqlite3 *db, /* Database handle */ | ||
int op, /* SQLITE_UPDATE, DELETE or INSERT */ | ||
char const *zDb, /* Database name */ | ||
char const *zName, /* Table name */ | ||
sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ | ||
sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ | ||
), | ||
void* | ||
); | ||
SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); | ||
SQLITE_API int sqlite3_preupdate_count(sqlite3 *); | ||
SQLITE_API int sqlite3_preupdate_depth(sqlite3 *); | ||
SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); | ||
#endif /* GRDB_SQLITE_ENABLE_PREUPDATE_HOOK */ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters