Details
Description
typeCast's column.string() and column.buffer() are wired to length-encoded readers in the binary decoder, where only variable-length values are length-encoded. On any fixed-width column they read the first data byte as a length prefix, returning garbage and desynchronizing the packet cursor, corrupting every remaining column of the row. This makes typeCast effectively unusable with execute().
const conn = await mariadb.createConnection({ ...cfg, typeCast: (field, next) => field.string() });
|
await conn.query('SELECT v FROM t'); // [{ v: '7' }] correct (text) |
await conn.execute('SELECT v FROM t'); // [{ v: '' }] wrong (binary) |