AllowedExperimental contains keywords for which the EXPERIMENTAL_ or TESTING_ prefixes are allowed to be parsed along with the keyword to the same token. This ambiguity exists during the deprecation period of an EXPERIMENTAL_ keyword as it is being transitioned to the normal version. Once the transition is done, the keyword should be removed from here as well.
DecodeRawBytesToByteArray converts raw bytes to a SQL-level byte array according to the encoding specification in "be". When using the Hex format, the caller is responsible for skipping the "\x" prefix, if any. See DecodeRawBytesToByteArrayAuto() below for an alternative.
DecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) and escape.
func EncodeByteArrayToRawBytes( data string, be sessiondata.BytesEncodeFormat, skipHexPrefix bool, ) string
EncodeByteArrayToRawBytes converts a SQL-level byte array into raw bytes according to the encoding specification in "be". If the skipHexPrefix argument is set, the hexadecimal encoding does not prefix the output with "\x". This is suitable e.g. for the encode() built-in.
EncodeEscapedSQLIdent writes the identifier in s to buf. The identifier is always quoted. Double quotes inside the identifier are escaped.
EncodeLocaleName writes the locale identifier in s to buf. Any dash characters are mapped to underscore characters. Underscore characters do not need to be quoted, and they are considered equivalent to dash characters by the CLDR standard: http://cldr.unicode.org/.
EncodeRestrictedSQLIdent writes the identifier in s to buf. The identifier is quoted if either the flags ask for it, the identifier contains special characters, or the identifier is a reserved SQL keyword.
EncodeSQLBytes encodes the SQL byte array in 'in' to buf, to a format suitable for re-scanning. We don't use a straightforward hex encoding here with x'...' because the result would be less compact. We are trading a little more time during the encoding to have a little less bytes on the wire.
EncodeSQLString writes a string literal to buf. All unicode and non-printable characters are escaped.
EncodeSQLStringWithFlags writes a string literal to buf. All unicode and non-printable characters are escaped. flags controls the output format: if encodeBareString is set, the output string will not be wrapped in quotes if the strings contains no special characters.
EncodeUnrestrictedSQLIdent writes the identifier in s to buf. The identifier is only quoted if the flags don't tell otherwise and the identifier contains special characters.
EscapeSQLString returns an escaped SQL representation of the given string. This is suitable for safely producing a SQL string valid for input to the parser.
IsDigit returns true if the character is between 0 and 9.
IsHexDigit returns true if the character is a valid hexadecimal digit.
IsIdentMiddle returns true if the character is valid inside an identifier.
IsIdentStart returns true if the character is valid at the start of an identifier.
NormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).
EncodeFlags influence the formatting of strings and identifiers.
const ( // EncNoFlags indicates nothing special should happen while encoding. EncNoFlags EncodeFlags = 0 // EncBareStrings indicates that strings will be rendered without // wrapping quotes if they contain no special characters. EncBareStrings EncodeFlags = 1 << iota // EncBareIdentifiers indicates that identifiers will be rendered // without wrapping quotes. EncBareIdentifiers // EncFirstFreeFlagBit needs to remain unused; it is used as base // bit offset for tree.FmtFlags. EncFirstFreeFlagBit )
HasFlags tests whether the given flags are set.