The vendored copy dated from 13 May 2007 (r9422) and segfaulted on any
statement carrying a bind parameter - which is nearly every statement a
4GL program issues - so SELECT ... WHERE id = lv_id or INSERT with
variables crashed while all-literal statements worked.
Two causes, both long since fixed upstream:
It built its SQL by textual substitution, calling
sqlite3_vmprintf(s->query, (char *) params) - an array of char * cast to
a va_list. That is valid on i386, where a va_list is effectively a
pointer to the stack arguments, and invalid on x86-64, where it is a
struct of register save area offsets. GCC 14 rejects the cast outright,
which is why this file was already built with the diagnostic switched
off. Upstream replaced the whole mechanism with sqlite3_bind_*() on
prepared statements years ago.
Its header was also pinned to sqlite3-local.h, which declares SQLite
3.0.8 (2004), while the plug-in links the system libsqlite3 3.45.1.
Anything added since 3.0.8 - sqlite3_prepare_v2, sqlite3_malloc - was
implicitly declared and had its returned pointer truncated on a 64 bit
build.
Upstream's sqlite3odbc.c and .h replace both files, keeping the small
Aubit preamble (the A4GL_debug shim and #define AUBIT). Three build
flags follow upstream's renames: WITHOUT_DRIVERMGR became
USE_DLOPEN_FOR_GPPS, WITHOUT_WINTERFACE avoids needing unixodbc-dev, and
the in-tree ODBC header gains SQL_C_WCHAR, a standard constant it
predates.
Parameterised statements, cursors and quote escaping now all work.