ComBind implements the Handler interface.
(ctx context.Context, c *mysql.Conn, query string, parsedQuery mysql.ParsedQuery, bindVars BindVariables, formatCodes []int16)
| 108 | |
| 109 | // ComBind implements the Handler interface. |
| 110 | func (h *DoltgresHandler) ComBind(ctx context.Context, c *mysql.Conn, query string, parsedQuery mysql.ParsedQuery, bindVars BindVariables, formatCodes []int16) (mysql.BoundQuery, []pgproto3.FieldDescription, error) { |
| 111 | sqlCtx, err := h.sm.NewContextWithQuery(ctx, c, query) |
| 112 | if err != nil { |
| 113 | return nil, nil, err |
| 114 | } |
| 115 | |
| 116 | stmt, ok := parsedQuery.(sqlparser.Statement) |
| 117 | if !ok { |
| 118 | return nil, nil, errors.Errorf("parsedQuery must be a sqlparser.Statement, but got %T", parsedQuery) |
| 119 | } |
| 120 | |
| 121 | bvs, err := h.convertBindParameters(sqlCtx, bindVars.varTypes, bindVars.formatCodes, bindVars.parameters) |
| 122 | if err != nil { |
| 123 | if printErrorStackTraces { |
| 124 | fmt.Printf("unable to convert bind params: %+v\n", err) |
| 125 | } |
| 126 | return nil, nil, err |
| 127 | } |
| 128 | |
| 129 | queryPlan, err := h.e.BoundQueryPlan(sqlCtx, query, stmt, bvs) |
| 130 | if err != nil { |
| 131 | if printErrorStackTraces { |
| 132 | fmt.Printf("unable to bind query plan: %+v\n", err) |
| 133 | } |
| 134 | return nil, nil, err |
| 135 | } |
| 136 | fields, err := schemaToFieldDescriptions(sqlCtx, queryPlan.Schema(sqlCtx), formatCodes) |
| 137 | return queryPlan, fields, err |
| 138 | } |
| 139 | |
| 140 | // ComExecuteBound implements the Handler interface. |
| 141 | func (h *DoltgresHandler) ComExecuteBound(ctx context.Context, conn *mysql.Conn, query string, boundQuery mysql.BoundQuery, formatCodes []int16, callback func(*sql.Context, *Result) error) error { |
nothing calls this directly
no test coverage detected