You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SQL_C_GUID parameter binding sending corrupted data on the wire
When an ODBC application called SQLBindParameter with C type SQL_C_GUID
and SQL type SQL_GUID, the driver accepted the call but did not convert
the 16-byte UUID into Firebird's wire format. Symptoms reported in #295:
* BINARY(16) / CHAR(16) CHARACTER SET OCTETS targets received the
ASCII bytes of the canonical UUID string truncated to 16 chars.
* Untyped VARCHAR parameters (e.g. inside CHAR_TO_UUID(?)) received
a wide-char buffer interpreted as narrow text, so Firebird raised
"Human readable UUID argument for CHAR_TO_UUID must have hex digit
at position 2 instead of ''".
Add two wire-only conversion functions and route SQL_C_GUID input
parameters to them:
* convGuidToBinary writes 16 raw bytes in canonical UUID byte order
(Data1/2/3 swapped from x86 little-endian to big-endian, Data4 as
is). Used for BINARY(16) / CHAR(16) OCTETS / FB4+ BINARY targets.
* convGuidToVarString stages the 36-char canonical UUID in the
DescRecord local buffer and redirects the wire's sqldata via
setSqlData(), matching the idiom transferStringToAllowedType
already uses. This sidesteps the SQLDA-allocated buffer being
only 2 bytes wide for an untyped `?` (VARCHAR(0)) placeholder.
The pre-existing convGuidToString / convGuidToStringW remain unchanged;
they handle the (currently unreachable) app-side fetch path that will
become live with the column-side SQL_GUID mapping work tracked under
#287 T5-5.
Expose getSqlSubtype() and getSqlLen() as read-only accessors on
HeadSqlVar so the dispatch in getAdressFunction can distinguish
sqlsubtype == 1 + sqllen == 16 (BINARY/CHAR(16) OCTETS, raw bytes)
from text wires of any other charset (canonical UUID string).
Add three GuidParamBindingTest acceptance tests covering the issue's
exact reproducers: SQL_C_GUID into CHAR(16) OCTETS, into VARCHAR via
CHAR_TO_UUID(?), and into BINARY(16) via UUID_TO_CHAR(?).
Closes#295.
0 commit comments