File tree 3 files changed +36
-1
lines changed
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>
71
71
# Organizations
72
72
73
73
Barracuda Networks, Inc.
74
+ Counting Ltd.
74
75
Google Inc.
75
76
Keybase Inc.
76
77
Pivotal Inc.
Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ func (mc *mysqlConn) startWatcher() {
197
197
}
198
198
199
199
func (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
201
205
return
202
206
}
Original file line number Diff line number Diff line change @@ -499,6 +499,36 @@ func TestString(t *testing.T) {
499
499
})
500
500
}
501
501
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
+
502
532
type timeTests struct {
503
533
dbtype string
504
534
tlayout string
You can’t perform that action at this time.
0 commit comments