utils_go18.go 875 B

123456789101112131415161718192021222324252627282930313233
  1. // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
  2. //
  3. // Copyright 2017 The Go-MySQL-Driver Authors. All rights reserved.
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public
  6. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  7. // You can obtain one at http://mozilla.org/MPL/2.0/.
  8. // +build go1.8
  9. package mysql
  10. import (
  11. "crypto/tls"
  12. "database/sql/driver"
  13. "errors"
  14. )
  15. func cloneTLSConfig(c *tls.Config) *tls.Config {
  16. return c.Clone()
  17. }
  18. func namedValueToValue(named []driver.NamedValue) ([]driver.Value, error) {
  19. dargs := make([]driver.Value, len(named))
  20. for n, param := range named {
  21. if len(param.Name) > 0 {
  22. // TODO: support the use of Named Parameters #561
  23. return nil, errors.New("mysql: driver does not support the use of Named Parameters")
  24. }
  25. dargs[n] = param.Value
  26. }
  27. return dargs, nil
  28. }