Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom functions to return nonzero BLOB #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jyopp
Copy link

@jyopp jyopp commented Apr 22, 2021

Context lacks the expected method ResultBlob for nonzero blobs, even though it implements ResultZeroBlob for zeroed blobs of arbitrary size. As a result, custom functions cannot currently return []byte results, such as cryptographic hashes.

@BrannonKing
Copy link

Fixes #124

@AdamSLevy AdamSLevy added the enhancement New feature or request label Nov 6, 2021
Copy link
Collaborator

@AdamSLevy AdamSLevy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. minor nit in the tests.

if stmt.ColumnBytes(0, got) != len(want) || !bytes.Equal(got, want) {
t.Errorf("blobcat(x'ff00',x'00ba')='%x', want '%x'", got, want)
}
stmt.Finalize()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defer this after line 155 please

if got, want := stmt.ColumnText(0), "strcat"; got != want {
t.Errorf("strcat('str','','cat')='%s', want '%s'", got, want)
}
stmt.Finalize()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

t.Fatal("Error does not match expected description")
}

stmt.Finalize()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants