You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc.go
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -188,11 +188,17 @@ Use the driverctx package under driverctx/ctx.go to add callbacks to the query c
188
188
189
189
Passing parameters to a query is supported when run against servers with version DBR 14.1.
190
190
191
+
// Named parameters:
191
192
p := dbsql.Parameter{Name: "p_bool", Value: true},
192
-
rows, err1 := db.QueryContext(ctx, `select * from sometable where condition=:p_bool`,dbsql.Parameter{Name: "p_bool", Value: true})
193
+
rows, err := db.QueryContext(ctx, `select * from sometable where condition=:p_bool`,dbsql.Parameter{Name: "p_bool", Value: true})
194
+
195
+
// Positional parameters - both `dbsql.Parameter` and plain values can be used:
196
+
rows, err := db.Query(`select *, ? from sometable where field=?`,dbsql.Parameter{Value: "123.456"}, "another parameter")
193
197
194
198
For complex types, you can specify the SQL type using the dbsql.Parameter type field. If this field is set, the value field MUST be set to a string.
195
199
200
+
Please note that named and positional parameters cannot be used together in the single query.
201
+
196
202
# Staging Ingestion
197
203
198
204
The Go driver now supports staging operations. In order to use a staging operation, you first must update the context with a list of folders that you are allowing the driver to access.
0 commit comments