| 153 | } |
| 154 | |
| 155 | func (b *sqlBuilder) ExecContext(ctx context.Context, query interface{}, args ...interface{}) (sql.Result, error) { |
| 156 | switch q := query.(type) { |
| 157 | case *exql.Statement: |
| 158 | return b.sess.StatementExec(ctx, q, args...) |
| 159 | case string: |
| 160 | return b.sess.StatementExec(ctx, exql.RawSQL(q), args...) |
| 161 | case *adapter.RawExpr: |
| 162 | return b.ExecContext(ctx, q.Raw(), q.Arguments()...) |
| 163 | default: |
| 164 | return nil, fmt.Errorf("unsupported query type %T", query) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func (b *sqlBuilder) Query(query interface{}, args ...interface{}) (*sql.Rows, error) { |
| 169 | return b.QueryContext(b.sess.Context(), query, args...) |