| 181 | } |
| 182 | |
| 183 | func (e *Executor) ColumnExists(ctx context.Context, params *riverdriver.ColumnExistsParams) (bool, error) { |
| 184 | // Unfortunately this doesn't work in sqlc because of the "table value" |
| 185 | // pragma isn't supported. This seems like it should be fixable, but for now |
| 186 | // run the raw SQL to accomplish it. |
| 187 | const sql = ` |
| 188 | SELECT EXISTS ( |
| 189 | SELECT 1 |
| 190 | FROM pragma_table_info |
| 191 | WHERE schema = ? AND arg = ? AND name = ? |
| 192 | )` |
| 193 | var exists int64 |
| 194 | if err := e.dbtx.QueryRowContext(ctx, sql, cmp.Or(params.Schema, "main"), params.Table, params.Column).Scan(&exists); err != nil { |
| 195 | return false, interpretError(err) |
| 196 | } |
| 197 | |
| 198 | return exists > 0, nil |
| 199 | } |
| 200 | |
| 201 | func (e *Executor) Exec(ctx context.Context, sql string, args ...any) error { |
| 202 | _, err := e.dbtx.ExecContext(ctx, sql, args...) |