Ryan Malloy fa3ab751f9 Phase 13: SQ_FPROUTINE / SQ_EXFPROUTINE fast-path RPC
Implements direct stored-procedure invocation via the parallel
fast-path protocol family. Three new wire messages:
* SQ_GETROUTINE (101) — handle resolution by signature
* SQ_EXFPROUTINE (102) — execute by handle with bound params
* SQ_FPROUTINE (103) — response with return values

API: Connection.fast_path_call(signature, *params) -> list

Routine handles cached per-connection in a dict[signature -> (db_name,
handle)] — first call resolves and caches, subsequent calls skip
GETROUTINE.

Why this matters even though Phase 10/11 already do most smart-LOB
work via SQL: ifx_lo_close(int) can't be invoked via "EXECUTE FUNCTION"
(returns -674). Without the fast-path, opened locators leak server-side
until the session ends. The fast-path also enables tighter UDF-in-loop
workloads — no PREPARE→DESCRIBE→EXECUTE overhead, just GETROUTINE+
EXFPROUTINE (one round-trip after caching).

Wire format examples (verified against JDBC):
* GETROUTINE request:
    [short 101][byte 0][int sigLen][sig bytes][pad if odd]
    [short 0][short SQ_EOT]
* EXFPROUTINE request:
    [short 102][short dbNameLen][dbName][pad if odd][int handle]
    [short paramCount][short fparamFlag][SQ_BIND data][short SQ_EOT]
* FPROUTINE response:
    [short numReturns][per-return: type/UDT-info/ind/prec/data]
    + drain SQ_DONE/SQ_COST/SQ_XACTSTAT until SQ_EOT

MVP scope:
* Scalar params/returns only (int/float/str/bool/None/etc.)
* UDT params (e.g., 72-byte BLOB locator) deferred to Phase 13.x
* SQ_LODATA chunked I/O deferred — Phase 10/11 already cover read/write

Tests: 5 integration tests covering error paths, success paths,
handle caching, and multiple cycles.

Total: 64 unit + 139 integration = 203 tests.

Architectural milestone: with Phase 13 complete, the project now
covers every wire-message family JDBC uses for ordinary database
work. Only TLS handshake and cluster-redirect (replication failover)
remain unimplemented — neither is needed for a single-instance
driver.
2026-05-04 14:36:21 -06:00
..