DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Static Public Member Functions | List of all members
Deveel.Data.Sql.QueryExtensions Class Reference

Static Public Member Functions

static bool ObjectExists (this IQuery query, ObjectName objectName)
 
static bool ObjectExists (this IQuery query, DbObjectType objectType, ObjectName objectName)
 
static IDbObject GetObject (this IQuery query, DbObjectType objType, ObjectName objName)
 
static IDbObject GetObject (this IQuery query, DbObjectType objType, ObjectName objName, AccessType accessType)
 
static void CreateObject (this IQuery query, IObjectInfo objectInfo)
 
static bool DropObject (this IQuery query, DbObjectType objectType, ObjectName objectName)
 
static void AlterObject (this IQuery query, IObjectInfo objectInfo)
 
static ObjectName ResolveObjectName (this IQuery query, string name)
 
static ObjectName ResolveObjectName (this IQuery query, DbObjectType objectType, ObjectName objectName)
 
static IDbObject FindObject (this IQuery query, ObjectName objectName)
 

Detailed Description

Definition at line 28 of file Query.Objects.cs.

Member Function Documentation

static void Deveel.Data.Sql.QueryExtensions.AlterObject ( this IQuery  query,
IObjectInfo  objectInfo 
)
inlinestatic

Definition at line 87 of file Query.Objects.cs.

87  {
88  if (objectInfo == null)
89  throw new ArgumentNullException("objectInfo");
90 
91  if (objectInfo.ObjectType == DbObjectType.Cursor ||
92  objectInfo.ObjectType == DbObjectType.Variable) {
93  throw new NotSupportedException();
94  }
95 
96  if (!query.UserCanAlterObject(objectInfo.ObjectType, objectInfo.FullName))
97  throw new MissingPrivilegesException(query.UserName(), objectInfo.FullName, Privileges.Alter);
98 
99  query.Session.AlterObject(objectInfo);
100  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static void Deveel.Data.Sql.QueryExtensions.CreateObject ( this IQuery  query,
IObjectInfo  objectInfo 
)
inlinestatic

Definition at line 66 of file Query.Objects.cs.

66  {
67  // TODO: throw a specialized exception
68  if (!query.UserCanCreateObject(objectInfo.ObjectType, objectInfo.FullName))
69  throw new InvalidOperationException();
70 
71  query.Session.CreateObject(objectInfo);
72  }
static bool Deveel.Data.Sql.QueryExtensions.DropObject ( this IQuery  query,
DbObjectType  objectType,
ObjectName  objectName 
)
inlinestatic

Definition at line 74 of file Query.Objects.cs.

74  {
75  if (objectType == DbObjectType.Cursor)
76  return query.Context.DropCursor(objectName.Name);
77  if (objectType == DbObjectType.Variable)
78  return query.Context.DropVariable(objectName.Name);
79 
80  if (!query.UserCanDropObject(objectType, objectName))
81  throw new MissingPrivilegesException(query.UserName(), objectName, Privileges.Drop);
82 
83  query.Session.DropObject(objectType, objectName);
84  return true;
85  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static IDbObject Deveel.Data.Sql.QueryExtensions.FindObject ( this IQuery  query,
ObjectName  objectName 
)
inlinestatic

Definition at line 122 of file Query.Objects.cs.

122  {
123  if (query.Context.CursorExists(objectName.Name))
124  return query.Context.FindCursor(objectName.Name);
125  if (query.Context.VariableExists(objectName.Name))
126  return query.Context.FindVariable(objectName.Name);
127 
128  return query.Session.FindObject(objectName);
129  }
static IDbObject Deveel.Data.Sql.QueryExtensions.GetObject ( this IQuery  query,
DbObjectType  objType,
ObjectName  objName 
)
inlinestatic

Definition at line 49 of file Query.Objects.cs.

49  {
50  return GetObject(query, objType, objName, AccessType.ReadWrite);
51  }
static IDbObject GetObject(this IQuery query, DbObjectType objType, ObjectName objName)
static IDbObject Deveel.Data.Sql.QueryExtensions.GetObject ( this IQuery  query,
DbObjectType  objType,
ObjectName  objName,
AccessType  accessType 
)
inlinestatic

Definition at line 53 of file Query.Objects.cs.

53  {
54  if (objType == DbObjectType.Cursor)
55  return query.Context.FindCursor(objName.Name);
56  if (objType == DbObjectType.Variable)
57  return query.Context.FindVariable(objName.Name);
58 
59  // TODO: throw a specialized exception
60  if (!query.UserCanAccessObject(objType, objName))
61  throw new InvalidOperationException();
62 
63  return query.Session.GetObject(objType, objName, accessType);
64  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static bool Deveel.Data.Sql.QueryExtensions.ObjectExists ( this IQuery  query,
ObjectName  objectName 
)
inlinestatic

Definition at line 29 of file Query.Objects.cs.

29  {
30  if (query.Context.VariableExists(objectName.Name))
31  return true;
32  if (query.Context.VariableExists(objectName.Name))
33  return true;
34 
35  return query.Session.ObjectExists(objectName);
36  }
static bool Deveel.Data.Sql.QueryExtensions.ObjectExists ( this IQuery  query,
DbObjectType  objectType,
ObjectName  objectName 
)
inlinestatic

Definition at line 38 of file Query.Objects.cs.

38  {
39  if (objectType == DbObjectType.Cursor &&
40  query.Context.CursorExists(objectName.Name))
41  return true;
42  if (objectType == DbObjectType.Variable &&
43  query.Context.VariableExists(objectName.Name))
44  return true;
45 
46  return query.Session.ObjectExists(objectType, objectName);
47  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static ObjectName Deveel.Data.Sql.QueryExtensions.ResolveObjectName ( this IQuery  query,
string  name 
)
inlinestatic

Definition at line 102 of file Query.Objects.cs.

102  {
103  if (query.Context.CursorExists(name))
104  return new ObjectName(name);
105  if (query.Context.VariableExists(name))
106  return new ObjectName(name);
107 
108  return query.Session.ResolveObjectName(name);
109  }
static ObjectName Deveel.Data.Sql.QueryExtensions.ResolveObjectName ( this IQuery  query,
DbObjectType  objectType,
ObjectName  objectName 
)
inlinestatic

Definition at line 111 of file Query.Objects.cs.

111  {
112  if (objectType == DbObjectType.Variable &&
113  query.Context.VariableExists(objectName.Name))
114  return new ObjectName(objectName.Name);
115  if (objectType == DbObjectType.Cursor &&
116  query.Context.VariableExists(objectName.Name))
117  return new ObjectName(objectName.Name);
118 
119  return query.Session.ResolveObjectName(objectType, objectName);
120  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27

The documentation for this class was generated from the following file: