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

mod: add sha2 built-in function #2914

Merged
merged 5 commits into from
Mar 24, 2017
Merged

mod: add sha2 built-in function #2914

merged 5 commits into from
Mar 24, 2017

Conversation

zs634134578
Copy link
Contributor

sha2 built-in function

@CLAassistant
Copy link

CLAassistant commented Mar 22, 2017

CLA assistant check
All committers have signed the CLA.

@shenli
Copy link
Member

shenli commented Mar 23, 2017

@zs634134578 Thanks! Please fix ci.

@zimulala zimulala added the contribution This PR is from a community contributor. label Mar 23, 2017
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

Thanks for your PR @zs634134578

if err != nil {
return d, errors.Trace(err)
}
// SHA2 function accepts 2 parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

Length of arguments would be checked in verifyArgs before,
so we don't need to check it here.

@@ -580,9 +583,58 @@ type builtinSHA2Sig struct {
baseBuiltinFunc
}

// Supported hash length as the second argument
Copy link
Contributor

Choose a reason for hiding this comment

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

Supported hash length of SHA-2 family.

c.Assert(crypt.IsNull(), IsTrue)
}
}
// Corner case 1: NULL input for sha2
Copy link
Contributor

Choose a reason for hiding this comment

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

For 0 args, and other incorrect parameter count, MySQL will cause error:
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'sha2'

TiDB will check the count of parameters here

@XuHuaiyu
Copy link
Contributor

LGTM

@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 24, 2017
@coocood
Copy link
Member

coocood commented Mar 24, 2017

LGTM
Thank you for your contribution.

@ngaut ngaut merged commit 88bfb59 into pingcap:master Mar 24, 2017
@zs634134578 zs634134578 deleted the builtin-sha2 branch March 31, 2017 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants