本文整理匯總了Golang中github.com/cockroachdb/cockroach/sql/driver.Request.GetParameters方法的典型用法代碼示例。如果您正苦於以下問題:Golang Request.GetParameters方法的具體用法?Golang Request.GetParameters怎麽用?Golang Request.GetParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/sql/driver.Request
的用法示例。
在下文中一共展示了Request.GetParameters方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: execute
func (s server) execute(args driver.Request) (driver.Response, int, error) {
// Pick up current session state.
planMaker := planner{user: args.GetUser()}
if err := gogoproto.Unmarshal(args.Session, &planMaker.session); err != nil {
return args.CreateReply(), http.StatusBadRequest, err
}
// Open a pending transaction if needed.
if planMaker.session.Txn != nil {
txn := client.NewTxn(s.db)
txn.Proto = *planMaker.session.Txn
if planMaker.session.MutatesSystemDB {
txn.SetSystemDBTrigger()
}
planMaker.txn = txn
}
// Send the Request for SQL execution and set the application-level error
// for each result in the reply.
reply := s.execStmts(args.Sql, args.GetParameters(), &planMaker)
// Send back the session state even if there were application-level errors.
// Add transaction to session state.
if planMaker.txn != nil {
planMaker.session.Txn = &planMaker.txn.Proto
planMaker.session.MutatesSystemDB = planMaker.txn.SystemDBTrigger()
} else {
planMaker.session.Txn = nil
planMaker.session.MutatesSystemDB = false
}
bytes, err := gogoproto.Marshal(&planMaker.session)
if err != nil {
return args.CreateReply(), http.StatusInternalServerError, err
}
reply.Session = bytes
return reply, 0, nil
}