Skip to content

VarChar and Char types lack ability to specify collation for parameters #129

Open
@shueybubbles

Description

func (s *Stmt) makeParamExtra(val driver.Value) (res param, err error) {
switch val := val.(type) {
	case VarChar:
		res.ti.TypeId = typeBigVarChar
		res.buffer = []byte(val)
		res.ti.Size = len(res.buffer)
	case VarCharMax:
		res.ti.TypeId = typeBigVarChar
		res.buffer = []byte(val)
		res.ti.Size = 0 // currently zero forces varchar(max)

Key problems:

  1. It's just sending the raw UTF8 bytes
  2. If the column is encrypted, the insert will always fail due to a type mismatch.
  3. The type aliases for string are too simplistic.

We can preserve backward compatibility of the aliases by allowing the app to specify a default collation for char and varchar types. We also need new types for per-parameter collation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Always EncryptedTasks related to implementation of AE

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions