From c18410606b9223f67385a6f7b79657e3d8ea2b9b Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Sat, 10 Jun 2017 02:12:07 -0700 Subject: [PATCH 1/2] use AppendFormat to format time values --- AUTHORS | 1 + packets.go | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5f27aa457..58c749e29 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,7 @@ # Individual Persons Aaron Hopkins +Achille Roussel Arne Hormann Asta Xie Bulat Gaifullin diff --git a/packets.go b/packets.go index 0bc120c0e..ef20923b8 100644 --- a/packets.go +++ b/packets.go @@ -1078,17 +1078,19 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error { paramTypes[i+i] = fieldTypeString paramTypes[i+i+1] = 0x00 - var val []byte + var a [64]byte + var b = a[:0] + if v.IsZero() { - val = []byte("0000-00-00") + b = append(b, "0000-00-00"...) } else { - val = []byte(v.In(mc.cfg.Loc).Format(timeFormat)) + b = v.In(mc.cfg.Loc).AppendFormat(b, timeFormat) } paramValues = appendLengthEncodedInteger(paramValues, - uint64(len(val)), + uint64(len(b)), ) - paramValues = append(paramValues, val...) + paramValues = append(paramValues, b...) default: return fmt.Errorf("can not convert type: %T", arg) From bfd41ad7876b085f0fa1f511c16c585d150324f6 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Sat, 10 Jun 2017 12:09:54 -0700 Subject: [PATCH 2/2] drop support for Go 1.4 --- .travis.yml | 1 - README.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a4236330b..0bfd17597 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: go go: - - 1.4 - 1.5 - 1.6 - 1.7 diff --git a/README.md b/README.md index 5a8937aa7..bfe40e15d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac * Optional placeholder interpolation ## Requirements - * Go 1.4 or higher + * Go 1.5 or higher * MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+) ---------------------------------------