Skip to content

Commit 2a482e4

Browse files
committed
minor bug fixes
1 parent 5728769 commit 2a482e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

driver.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func Register(driverName string, options ...TraceOption) (string, error) {
7373
// Since we might want to register multiple ocsql drivers to have different
7474
// TraceOptions, but potentially the same underlying database driver, we
7575
// cycle through available driver names.
76-
driverName = "ocsql-" + driverName
76+
driverName = driverName + "-ocsql-"
7777
for i := int64(0); i < 100; i++ {
7878
var (
7979
found = false
@@ -85,8 +85,8 @@ func Register(driverName string, options ...TraceOption) (string, error) {
8585
}
8686
}
8787
if !found {
88-
sql.Register(driverName, Wrap(dri, options...))
89-
return driverName, nil
88+
sql.Register(regName, Wrap(dri, options...))
89+
return regName, nil
9090
}
9191
}
9292
return "", errors.New("unable to register driver, all slots have been taken")
@@ -601,21 +601,21 @@ func paramsAttr(args []driver.Value) []trace.Attribute {
601601
attrs := make([]trace.Attribute, 0, len(args))
602602
for i, arg := range args {
603603
key := "sql.arg" + strconv.Itoa(i)
604-
attrs[i] = argToAttr(key, arg)
604+
attrs = append(attrs, argToAttr(key, arg))
605605
}
606606
return attrs
607607
}
608608

609609
func namedParamsAttr(args []driver.NamedValue) []trace.Attribute {
610610
attrs := make([]trace.Attribute, 0, len(args))
611-
for i, arg := range args {
611+
for _, arg := range args {
612612
var key string
613613
if arg.Name != "" {
614614
key = arg.Name
615615
} else {
616616
key = "sql.arg." + strconv.Itoa(arg.Ordinal)
617617
}
618-
attrs[i] = argToAttr(key, arg.Value)
618+
attrs = append(attrs, argToAttr(key, arg.Value))
619619
}
620620
return attrs
621621
}

0 commit comments

Comments
 (0)