Wrong definitions in ZPlainSqLiteDriver
Posted: 21.03.2023, 09:28
There are some wrong definitions in ZPlainSqLiteDriver, nothing big but it affects anyone who will try to work with SQLite directly
Current code (as of 2023/1/17)
But in the C header it is
meaning that SQLITE_STATIC and SQLITE_TRANSIENT are not types but values (or consts for that matter)
so the actual translation should be
This is also the case with Sqlite3 unit that comes with Lazarus (version 2.2.4):
Thanks,
Current code (as of 2023/1/17)
Code: Select all
type
Tsqlite3_destructor_type = procedure(user: pointer); cdecl;
SQLITE_STATIC = procedure(User: Pointer = Nil); cdecl;
SQLITE_TRANSIENT = procedure(User: pointer = Pointer(-1)); cdecl;
Code: Select all
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
so the actual translation should be
Code: Select all
type
Tsqlite3_destructor_type = procedure(Ptr: Pointer); cdecl;
const
SQLITE_STATIC: Tsqlite3_destructor_type = nil;
SQLITE_TRANSIENT: Tsqlite3_destructor_type = Pointer(-1);
Code: Select all
type
sqlite3_destructor_type = procedure(user: pointer); cdecl;
const
SQLITE_STATIC = sqlite3_destructor_type(nil);
SQLITE_TRANSIENT = pointer(-1); //sqlite3_destructor_type(-1);