mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:12:44 +00:00 
			
		
		
		
	 3ea4c56d04
			
		
	
	
		3ea4c56d04
		
	
	
	
	
		
			
			This relationship was only used to provide a name, factory methods, and parent-child relationships for the relations.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			636 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			636 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibSQL/AST/AST.h>
 | |
| #include <LibSQL/Database.h>
 | |
| #include <LibSQL/Meta.h>
 | |
| 
 | |
| namespace SQL::AST {
 | |
| 
 | |
| ResultOr<ResultSet> CreateSchema::execute(ExecutionContext& context) const
 | |
| {
 | |
|     auto schema_def = TRY(SchemaDef::create(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 };
 | |
| }
 | |
| 
 | |
| }
 |