DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Cursors.CursorManager Class Reference
Inheritance diagram for Deveel.Data.Sql.Cursors.CursorManager:
Deveel.Data.Sql.IObjectManager

Public Member Functions

 CursorManager (ICursorScope scope)
 
void Dispose ()
 
ObjectName ResolveName (ObjectName objName, bool ignoreCase)
 Normalizes the input object name using the case sensitivity specified. More...
 
void DeclareCursor (CursorInfo cursorInfo)
 
bool CursorExists (string cursorName)
 
Cursor GetCursor (string cursorName)
 
bool DropCursor (string cursorName)
 

Package Functions

void DisposeCursor (Cursor cursor)
 

Properties

ICursorScope Scope [get, private set]
 
DbObjectType IObjectManager. ObjectType [get]
 
- Properties inherited from Deveel.Data.Sql.IObjectManager
DbObjectType ObjectType [get]
 Gets the type of objects managed by this instance. More...
 

Private Member Functions

 ~CursorManager ()
 
void Dispose (bool disposing)
 
void IObjectManager. Create ()
 Initializes the manager into the underlying system. More...
 
void IObjectManager. CreateObject (IObjectInfo objInfo)
 Create a new object of the ObjectType given the specifications given. More...
 
bool IObjectManager. RealObjectExists (ObjectName objName)
 Checks if an object really exists in the system. More...
 
bool IObjectManager. ObjectExists (ObjectName objName)
 Checks if an object identified by the given name is managed by this instance. More...
 
IDbObject IObjectManager. GetObject (ObjectName objName)
 Gets a database object managed by this manager. More...
 
bool IObjectManager. AlterObject (IObjectInfo objInfo)
 Modifies an existing object managed, identified by IObjectInfo.FullName component of the given specification, with the format given. More...
 
bool IObjectManager. DropObject (ObjectName objName)
 Deletes a database object handled by this manager from the system. More...
 

Private Attributes

List< Cursorcursors
 

Detailed Description

Definition at line 22 of file CursorManager.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Cursors.CursorManager.CursorManager ( ICursorScope  scope)
inline

Definition at line 25 of file CursorManager.cs.

25  {
26  if (scope == null)
27  throw new ArgumentNullException("scope");
28 
29  Scope = scope;
30  cursors = new List<Cursor>();
31  }
Deveel.Data.Sql.Cursors.CursorManager.~CursorManager ( )
inlineprivate

Definition at line 33 of file CursorManager.cs.

33  {
34  Dispose(false);
35  }

Member Function Documentation

bool IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.AlterObject ( IObjectInfo  objInfo)
inlineprivate

Modifies an existing object managed, identified by IObjectInfo.FullName component of the given specification, with the format given.

Parameters
objInfoThe object specification used to alter an existing object.
Returns
Returns true an object was identified and successfully altered, or false if none database object was found for the unique name given.
Exceptions
ArgumentNullExceptionIf the given objInfo object is null.
ArgumentExceptionIf the type of the object specified (IObjectInfo.ObjectType) is different than the type of objects handled by this manager.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 82 of file CursorManager.cs.

82  {
83  throw new NotSupportedException("Cannot alter a cursor");
84  }
void IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.Create ( )
inlineprivate

Initializes the manager into the underlying system.

Typically this method generates the tables required to manage the features relative to the objects.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 63 of file CursorManager.cs.

63  {
64  }
void IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.CreateObject ( IObjectInfo  objInfo)
inlineprivate

Create a new object of the ObjectType given the specifications given.

Parameters
objInfoThe object specifications used to create a new object.
Exceptions
ArgumentNullExceptionIf the given objInfo is null.
ArgumentExceptionIf the object type of the specification (IObjectInfo.ObjectType) is different than the ObjectType of this manager.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 66 of file CursorManager.cs.

66  {
67  DeclareCursor((CursorInfo)objInfo);
68  }
void DeclareCursor(CursorInfo cursorInfo)
bool Deveel.Data.Sql.Cursors.CursorManager.CursorExists ( string  cursorName)
inline

Definition at line 117 of file CursorManager.cs.

117  {
118  var ignoreCase = Scope.IgnoreCase;
119  var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
120  return cursors.Any(x => x.CursorInfo.CursorName.Equals(cursorName, comparison));
121  }
void Deveel.Data.Sql.Cursors.CursorManager.DeclareCursor ( CursorInfo  cursorInfo)
inline

Definition at line 102 of file CursorManager.cs.

102  {
103  if (cursorInfo == null)
104  throw new ArgumentNullException("cursorInfo");
105 
106 
107  lock (this) {
108  var cursorName = cursorInfo.CursorName;
109  if (cursors.Any(x => x.CursorInfo.CursorName.Equals(cursorName, StringComparison.OrdinalIgnoreCase)))
110  throw new ArgumentException(String.Format("Cursor '{0}' was already declared.", cursorName));
111 
112  var cursor = new Cursor(cursorInfo);
113  cursors.Add(cursor);
114  }
115  }
A long string in the system.
A cursor is a named, precomputed, query, that accepts optional parameters and handles a state of the ...
void Deveel.Data.Sql.Cursors.CursorManager.Dispose ( )
inline

Definition at line 39 of file CursorManager.cs.

39  {
40  Dispose(true);
41  GC.SuppressFinalize(this);
42  }
void Deveel.Data.Sql.Cursors.CursorManager.Dispose ( bool  disposing)
inlineprivate

Definition at line 44 of file CursorManager.cs.

44  {
45  if (disposing) {
46  if (cursors != null) {
47  foreach (var cursor in cursors) {
48  cursor.Dispose();
49  }
50 
51  cursors.Clear();
52  }
53  }
54 
55  cursors = null;
56  Scope = null;
57  }
void Deveel.Data.Sql.Cursors.CursorManager.DisposeCursor ( Cursor  cursor)
inlinepackage

Definition at line 129 of file CursorManager.cs.

129  {
130  var name = cursor.CursorInfo.CursorName;
131  for (int i = cursors.Count - 1; i >= 0; i--) {
132  var cursorName = cursors[i].CursorInfo.CursorName;
133  if (cursorName.Equals(name, StringComparison.OrdinalIgnoreCase))
134  cursors.RemoveAt(i);
135  }
136  }
bool Deveel.Data.Sql.Cursors.CursorManager.DropCursor ( string  cursorName)
inline

Definition at line 138 of file CursorManager.cs.

138  {
139  var ignoreCase = Scope.IgnoreCase;
140  var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
141  for (int i = cursors.Count - 1; i >= 0; i--) {
142  var cursor = cursors[i];
143  if (cursor.CursorInfo.CursorName.Equals(cursorName, comparison)) {
144  cursors.RemoveAt(i);
145  cursor.Dispose();
146  return true;
147  }
148  }
149 
150  return false;
151  }
bool IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.DropObject ( ObjectName  objName)
inlineprivate

Deletes a database object handled by this manager from the system.

Parameters
objNameThe unique name of the object to be deleted.
Returns
Returns true if a database object was found with the given unique name and successfully deleted from the system, or false if none object was found.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 86 of file CursorManager.cs.

86  {
87  return DropCursor(objName.Name);
88  }
bool DropCursor(string cursorName)
Cursor Deveel.Data.Sql.Cursors.CursorManager.GetCursor ( string  cursorName)
inline

Definition at line 123 of file CursorManager.cs.

123  {
124  var ignoreCase = Scope.IgnoreCase;
125  var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
126  return cursors.FirstOrDefault(x => x.CursorInfo.CursorName.Equals(cursorName, comparison));
127  }
IDbObject IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.GetObject ( ObjectName  objName)
inlineprivate

Gets a database object managed by this manager.

Parameters
objNameThe name that uniquely identifies the object to get.
Returns
Returns a IDbObject instance that is identified by the given unique name, or null if this manager was not able to map any object to the name specified.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 78 of file CursorManager.cs.

78  {
79  return GetCursor(objName.Name);
80  }
Cursor GetCursor(string cursorName)
bool IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.ObjectExists ( ObjectName  objName)
inlineprivate

Checks if an object identified by the given name is managed by this instance.

Parameters
objNameThe name that uniquely identifies the object.
Returns

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 74 of file CursorManager.cs.

74  {
75  return CursorExists(objName.Name);
76  }
bool CursorExists(string cursorName)
bool IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.RealObjectExists ( ObjectName  objName)
inlineprivate

Checks if an object really exists in the system.

Parameters
objNameThe unique name of the object to check.
Returns
Returns true if an object with the given name concretely exists in the system, or false otherwise.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 70 of file CursorManager.cs.

70  {
71  return CursorExists(objName.Name);
72  }
bool CursorExists(string cursorName)
ObjectName Deveel.Data.Sql.Cursors.CursorManager.ResolveName ( ObjectName  objName,
bool  ignoreCase 
)
inline

Normalizes the input object name using the case sensitivity specified.

Parameters
objNameThe input object name, that can be partial or complete, to be normalized to the real name of an object.
ignoreCaseThe case sensitivity specification used to compare the input name with the names of the existing objects handled by this manager.
Returns
Returns the fully normalized ObjectName that is the real name of an object matching the input name, or null if the input name was not possible to be resolved.

Implements Deveel.Data.Sql.IObjectManager.

Definition at line 90 of file CursorManager.cs.

90  {
91  var ojectName = objName.Name;
92  var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
93  foreach (var cursor in cursors) {
94  var cursorName = cursor.CursorInfo.CursorName;
95  if (cursorName.Equals(ojectName, comparison))
96  return new ObjectName(cursorName);
97  }
98 
99  return null;
100  }

Member Data Documentation

List<Cursor> Deveel.Data.Sql.Cursors.CursorManager.cursors
private

Definition at line 23 of file CursorManager.cs.

Property Documentation

DbObjectType IObjectManager. Deveel.Data.Sql.Cursors.CursorManager.ObjectType
getprivate

Definition at line 59 of file CursorManager.cs.

ICursorScope Deveel.Data.Sql.Cursors.CursorManager.Scope
getprivate set

Definition at line 37 of file CursorManager.cs.


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