Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Buffer as values #89

Copy link
Copy link
Open
Open
Copy link
@adespawn

Description

@adespawn
Issue body actions

EDIT: After some investigation, it appears any value can be provided as buffer, empty or not

add support so that test: should support retrieving empty buffers as values passes

it("should support retrieving empty buffers as values", () => {
// Include some columns to make sure the behaviour is consistent across different types.
// Inserting empty buffers fails server side for some types, e.g., "Not enough bytes to read a list"
const columnsAsNulls = [
"bigint_sample",
"int_sample",
"double_sample",
"timeuuid_sample",
];
const columns = ["text_sample", "blob_sample"].concat(
columnsAsNulls,
);
const insertQuery =
`INSERT INTO ${table} (id, ${columns.join(",")})` +
` VALUES (?, ${columns.map(() => "?").join(",")})`;
const selectQuery = `SELECT * FROM ${table} WHERE id = ?`;
const emptyBuffer = utils.allocBufferUnsafe(0);
const id = types.Uuid.random();
const client = setupInfo.client;
return client
.execute(
insertQuery,
[id].concat(columns.map(() => emptyBuffer)),
)
.then(() => client.execute(selectQuery, [id]))
.then((rs) => {
const row = rs.first();
columnsAsNulls.forEach((c) =>
assert.strictEqual(row[c], null),
);
assert.strictEqual(row["text_sample"], "");
assert.deepStrictEqual(
row["blob_sample"],
utils.allocBufferUnsafe(0),
);
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority.Normal priority.TypesCustom types used by the databaseCustom types used by the database

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.