Skip to content

Inserting buffer data into a String/FixedString field #837

Description

@wundersolutions-juanjo

As the title asks, is there a way of inserting buffer data into a String/FixedString field?

I havent had much luck with anything other than FORMAT JSONEachRow, but it fails for the FixedString data

await client.insert({
	table: table,
	values: values, //JS Objects, not serialized in any way
	format: 'JSONEachRow',
});

Using toString with hex, base64, utf8, binary, latin1 encodings leads to a TOO_LARGE_STRING_SIZE error
Using toString with ascii causes the first bit to be dropped, converting 0xF0F0 to 0x0000

Is there any other way of inserting JSON data using the client?
I can think of using exec with unhex(val), but that'd be quite the hassle when dealing with large tables since I'd need to type all of the columns and parameters with their respective types

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions