18 using System.Collections.Generic;
21 namespace Deveel.Data.Sql.Cursors {
27 throw new ArgumentNullException(
"scope");
30 cursors =
new List<Cursor>();
41 GC.SuppressFinalize(
this);
46 if (cursors != null) {
47 foreach (var cursor
in cursors) {
71 return CursorExists(objName.
Name);
75 return CursorExists(objName.
Name);
79 return GetCursor(objName.
Name);
83 throw new NotSupportedException(
"Cannot alter a cursor");
87 return DropCursor(objName.
Name);
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))
103 if (cursorInfo == null)
104 throw new ArgumentNullException(
"cursorInfo");
109 if (cursors.Any(x => x.CursorInfo.CursorName.Equals(cursorName, StringComparison.OrdinalIgnoreCase)))
110 throw new ArgumentException(String.Format(
"Cursor '{0}' was already declared.", cursorName));
112 var cursor =
new Cursor(cursorInfo);
118 var ignoreCase = Scope.IgnoreCase;
119 var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
120 return cursors.Any(x => x.CursorInfo.CursorName.Equals(cursorName, comparison));
124 var ignoreCase = Scope.IgnoreCase;
125 var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
126 return cursors.FirstOrDefault(x => x.CursorInfo.CursorName.Equals(cursorName, comparison));
131 for (
int i = cursors.Count - 1; i >= 0; i--) {
132 var cursorName = cursors[i].CursorInfo.CursorName;
133 if (cursorName.Equals(name, StringComparison.OrdinalIgnoreCase))
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)) {
bool AlterObject(IObjectInfo objInfo)
Modifies an existing object managed, identified by IObjectInfo.FullName component of the given specif...
Cursor GetCursor(string cursorName)
bool DropObject(ObjectName objName)
Deletes a database object handled by this manager from the system.
void Create()
Initializes the manager into the underlying system.
bool RealObjectExists(ObjectName objName)
Checks if an object really exists in the system.
bool CursorExists(string cursorName)
Represents a database object, such as a table, a trigger, a type or a column.
ObjectName ResolveName(ObjectName objName, bool ignoreCase)
Normalizes the input object name using the case sensitivity specified.
Describes the name of an object within a database.
void CreateObject(IObjectInfo objInfo)
Create a new object of the ObjectType given the specifications given.
bool DropCursor(string cursorName)
void DisposeCursor(Cursor cursor)
DbObjectType ObjectType
Gets the type of objects managed by this instance.
string Name
Gets the name of the object being referenced.
IDbObject GetObject(ObjectName objName)
Gets a database object managed by this manager.
bool ObjectExists(ObjectName objName)
Checks if an object identified by the given name is managed by this instance.
void DeclareCursor(CursorInfo cursorInfo)
Defines the contract for the business managers of database objects of a given type.
void Dispose(bool disposing)
DbObjectType
The kind of objects that can be handled by a database system and its managers
CursorManager(ICursorScope scope)