File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ Zhenye Xie <xiezhenye at gmail.com>
7171# Organizations
7272
7373Barracuda Networks, Inc.
74+ Counting Ltd.
7475Google Inc.
7576Keybase Inc.
7677Pivotal Inc.
Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ func (mc *mysqlConn) startWatcher() {
197197}
198198
199199func (mc * mysqlConn ) CheckNamedValue (nv * driver.NamedValue ) (err error ) {
200- nv .Value , err = converter {}.ConvertValue (nv .Value )
200+ value , err := converter {}.ConvertValue (nv .Value )
201+ if err != nil {
202+ return driver .ErrSkip
203+ }
204+ nv .Value = value
201205 return
202206}
Original file line number Diff line number Diff line change @@ -499,6 +499,36 @@ func TestString(t *testing.T) {
499499 })
500500}
501501
502+ type testValuer struct {
503+ value string
504+ }
505+
506+ func (tv testValuer ) Value () (driver.Value , error ) {
507+ return tv .value , nil
508+ }
509+
510+ func TestValuer (t * testing.T ) {
511+ runTests (t , dsn , func (dbt * DBTest ) {
512+ in := testValuer {"a_value" }
513+ var out string
514+ var rows * sql.Rows
515+
516+ dbt .mustExec ("CREATE TABLE test (value VARCHAR(255)) CHARACTER SET utf8" )
517+ dbt .mustExec ("INSERT INTO test VALUES (?)" , in )
518+ rows = dbt .mustQuery ("SELECT value FROM test" )
519+ if rows .Next () {
520+ rows .Scan (& out )
521+ if in .value != out {
522+ dbt .Errorf ("Valuer: %v != %s" , in , out )
523+ }
524+ } else {
525+ dbt .Errorf ("Valuer: no data" )
526+ }
527+
528+ dbt .mustExec ("DROP TABLE IF EXISTS test" )
529+ })
530+ }
531+
502532type timeTests struct {
503533 dbtype string
504534 tlayout string
You can’t perform that action at this time.
0 commit comments