(ctx context.Context, statement string)
| 204 | } |
| 205 | |
| 206 | func (d *Driver) createDatabaseExecute(ctx context.Context, statement string) error { |
| 207 | databaseName, err := getDatabaseInCreateDatabaseStatement(statement) |
| 208 | if err != nil { |
| 209 | return err |
| 210 | } |
| 211 | databases, err := d.getDatabases(ctx) |
| 212 | if err != nil { |
| 213 | return err |
| 214 | } |
| 215 | for _, database := range databases { |
| 216 | if database.Name == databaseName { |
| 217 | // Database already exists. |
| 218 | return nil |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | for _, s := range strings.Split(statement, "\n") { |
| 223 | if _, err := d.db.ExecContext(ctx, s); err != nil { |
| 224 | return err |
| 225 | } |
| 226 | } |
| 227 | return nil |
| 228 | } |
| 229 | |
| 230 | // executeInTransactionMode executes statements within a single transaction |
| 231 | func (d *Driver) executeInTransactionMode(ctx context.Context, commands []base.Statement, opts db.ExecuteOptions) (int64, error) { |
no test coverage detected