Adding support for buffers in a few places - this helps with BYTE type columns in SQL.

This commit is contained in:
mike12345567 2024-05-09 15:10:05 +01:00
parent db273bcd36
commit 381c33cfb5
2 changed files with 9 additions and 1 deletions

View File

@ -73,12 +73,15 @@ export function basicProcessing({
// filter the row down to what is actually the row (not joined) // filter the row down to what is actually the row (not joined)
for (let field of Object.values(table.schema)) { for (let field of Object.values(table.schema)) {
const fieldName = field.name const fieldName = field.name
const value = extractFieldValue({ let value = extractFieldValue({
row, row,
tableName: table.name, tableName: table.name,
fieldName, fieldName,
isLinked, isLinked,
}) })
if (value instanceof Buffer) {
value = value.toString()
}
// all responses include "select col as table.col" so that overlaps are handled // all responses include "select col as table.col" so that overlaps are handled
if (value != null) { if (value != null) {
thisRow[fieldName] = value thisRow[fieldName] = value

View File

@ -192,6 +192,11 @@ export function generateRowIdField(keyProps: any[] = []) {
if (!Array.isArray(keyProps)) { if (!Array.isArray(keyProps)) {
keyProps = [keyProps] keyProps = [keyProps]
} }
for (let index in keyProps) {
if (keyProps[index] instanceof Buffer) {
keyProps[index] = keyProps[index].toString()
}
}
// this conserves order and types // this conserves order and types
// we have to swap the double quotes to single quotes for use in HBS statements // we have to swap the double quotes to single quotes for use in HBS statements
// when using the literal helper the double quotes can break things // when using the literal helper the double quotes can break things