/* * Copyright (c) 2021, Jan de Visser * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include namespace SQL::AST { ResultOr CreateSchema::execute(ExecutionContext& context) const { auto schema_def = SchemaDef::construct(m_schema_name); if (auto result = context.database->add_schema(*schema_def); result.is_error()) { if (result.error().error() != SQLErrorCode::SchemaExists || m_is_error_if_schema_exists) return result.release_error(); } return ResultSet { SQLCommand::Create }; } }