Runtime configuration
The runtime library libgixsql is configured by environment variables. Some of them can also be set per connection, with an option of the connection string (Connection options), which has priority.
Environment variables
| Variable | Default | Description |
|---|---|---|
GIXSQL_DEFAULT_DRIVER |
driver used when the connection string names none (The default driver) | |
GIXSQL_AUTOCOMMIT |
native |
on, off or native (Autocommit) |
GIXSQL_CLIENT_ENCODING |
client encoding (PostgreSQL, MySQL) | |
GIXSQL_FIXUP_PARAMS |
off |
convert the placeholders of prepared statements (Parameter placeholders) |
GIXSQL_NOREC_CODE |
100 |
SQLCODE of the “no record” condition (The “no record” condition) |
GIXSQL_VARYING_LEN_SZ_SHORT |
0 |
1 if the VARYING length fields are 2 bytes; not needed for programs precompiled with -N 2 |
GIXSQL_LOG_LEVEL |
error |
see Logging |
GIXSQL_LOG_FILE |
gixsql.log |
see Logging |
GIXSQL_LOG_TRUNCATE |
off |
see Logging |
GIXSQL_LOG_ROTATE |
off |
see Logging |
GIXSQL_LOG_ROTATE_MAX_SIZE |
10M |
see Logging |
GIXSQL_LOG_ROTATE_MAX_FILES |
5 |
see Logging |
GIXSQL_LOG_ROTATE_ON_OPEN |
on |
see Logging |
Boolean variables accept on/off and 1/0.
GIXSQL_USRPWD_SEP is read by the runtime but has no effect in the current version: the separator between the user name and the password is always a dot.
The drivers also use the variables of their client libraries, for example PGHOST or PGSSLMODE for PostgreSQL, NLS_LANG and TNS_ADMIN for Oracle, ODBCINI for unixODBC.
Finding the drivers
libgixsql loads the driver libgixsql-<driver>.so (libgixsql-<driver>.dll on Windows) with the system dynamic loader. The directory of the drivers must be in LD_LIBRARY_PATH (PATH on Windows), or in the system library path.
Logging
The runtime writes a log, with spdlog.
GIXSQL_LOG_LEVEL-
off,critical,error(default),warn,info,debugortrace. Thetracelevel logs every call, with the values of the host variables (including passwords and other sensitive data), and slows down the programs. GIXSQL_LOG_FILE-
the log file (default
gixsql.log, in the current directory). GIXSQL_LOG_TRUNCATE-
onto truncate the log file when the program starts. GIXSQL_LOG_ROTATE-
onto rotate the log files. GIXSQL_LOG_ROTATE_MAX_SIZE-
the maximal size of a log file, with an optional suffix
B,K,M(default) orG(default10M). GIXSQL_LOG_ROTATE_MAX_FILES- the number of files kept (default 5).
GIXSQL_LOG_ROTATE_ON_OPEN-
on(default) to rotate when the program starts.
For example, to trace a program:
$ GIXSQL_LOG_LEVEL=trace GIXSQL_LOG_FILE=/tmp/prog.log ./prog