DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
QueryContext.Schemas.cs
Go to the documentation of this file.
1 using System;
2 
3 using Deveel.Data.Security;
4 
5 namespace Deveel.Data.Sql.Schemas {
6  public static class QueryContext {
7  public static void CreateSchema(this IQueryContext context, string name, string type) {
8  if (!context.UserCanCreateSchema())
9  throw new InvalidOperationException(); // TODO: throw a specialized exception
10 
11  context.CreateObject(new SchemaInfo(name, type));
12  }
13 
14  public static bool SchemaExists(this IQueryContext context, string name) {
15  return context.ObjectExists(DbObjectType.Schema, new ObjectName(name));
16  }
17 
18  public static ObjectName ResolveSchemaName(this IQueryContext context, string name) {
19  if (String.IsNullOrEmpty(name))
20  throw new ArgumentNullException("name");
21 
22  return context.ResolveObjectName(DbObjectType.Schema, new ObjectName(name));
23  }
24  }
25 }
static ObjectName ResolveSchemaName(this IQueryContext context, string name)
static bool SchemaExists(this IQueryContext context, string name)
Provides a context for executing queries, accessing the system resources and evaluation context...
Describes the name of an object within a database.
Definition: ObjectName.cs:44
static void CreateSchema(this IQueryContext context, string name, string type)
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
Describes the properties of a schema in a database system.
Definition: SchemaInfo.cs:39