Oninit® 4gl2everywhere — Pluggable Backends
The bridge dispatches translated SQL to a configured target database via a uniform interface. The current backends — PostgreSQL, MySQL / MariaDB, Oracle, and a built-in null mock — are runtime-selectable per listener via the YAML configuration.
Backend interface
Each backend exposes the same operational verbs — connect, disconnect, database open / close, execute, fetch, transaction control, and a backend-specific error-mapping facility. The bridge selects the backend at session start based on the listener's configured backend type; SQL translated by the dialect rewriter is dispatched through the same interface regardless of target.
Per-backend specifics
| Backend | Driver | Connect | Database verb |
|---|---|---|---|
| PostgreSQL | libpq | PQconnectdb(dsn) | SET search_path TO "<dbname>" — treats Informix dbname as a postgres schema (postgres binds DB at connect-time). |
| MySQL / MariaDB | libmysqlclient or libmariadb | mysql_real_connect() | mysql_select_db() — native C API verb, avoids SQL escaping. |
| Oracle | OCI / Instant Client | OCIServerAttach + OCISessionBegin | ALTER SESSION SET CURRENT_SCHEMA = "<dbname>". |
| null mock | (in-process) | no-op | no-op — for protocol bring-up without a real database. |
Database verb mapping
SQ_DBOPEN — the on-wire equivalent of the 4GL DATABASE name statement — carries a u16 dblen + dbname (even-padded) + u16 mode trailer. The bridge validates dbname against the Informix-legal identifier grammar ([A-Za-z_][A-Za-z0-9_$.]{0,127}) and dispatches to the configured backend's database-switch verb. The mode trailer (Informix exclusive / quiescent modes) is parsed-but-ignored — those don't translate cleanly to any target backend.
DSN format
The per-listener YAML config carries a backend block with type and dsn. The DSN string is fed verbatim to the underlying client library: PQconnectdb accepts "host=… dbname=…" or postgres://… URIs; OCI accepts TNS or EZ-CONNECT; MySQL parses the keyword form. The bridge does not parse the DSN itself.