Skip to content

Allow custom functions to return nonzero BLOB - #121

Open
jyopp wants to merge 1 commit into
crawshaw:masterfrom
jyopp:context-blobs
Open

Allow custom functions to return nonzero BLOB#121
jyopp wants to merge 1 commit into
crawshaw:masterfrom
jyopp:context-blobs

Conversation

@jyopp

Copy link
Copy Markdown

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
Copy Markdown

Fixes #124

@AdamSLevyAdamSLevy added the enhancement New feature or request label Nov 6, 2021

@AdamSLevyAdamSLevy left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment threadfunc_test.go
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
Copy Markdown
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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ditto

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

stmt.Finalize()

Copy link
Copy Markdown
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jyopp@BrannonKing@AdamSLevy