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

Provides some convenience extension methods to ITransaction instances. More...

Static Public Member Functions

static void CreateSystem (this ITransaction transaction)
 
static TableManager GetTableManager (this ITransaction transaction)
 
static TriggerManager GetTriggerManager (this ITransaction transaction)
 
static IDbObject FindObject (this ITransaction transaction, ObjectName objName)
 
static IDbObject GetObject (this ITransaction transaction, DbObjectType objType, ObjectName objName)
 
static bool ObjectExists (this ITransaction transaction, ObjectName objName)
 
static bool ObjectExists (this ITransaction transaction, DbObjectType objType, ObjectName objName)
 
static bool RealObjectExists (this ITransaction transaction, DbObjectType objType, ObjectName objName)
 
static void CreateObject (this ITransaction transaction, IObjectInfo objInfo)
 
static bool AlterObject (this ITransaction transaction, IObjectInfo objInfo)
 
static bool DropObject (this ITransaction transaction, DbObjectType objType, ObjectName objName)
 
static ObjectName ResolveObjectName (this ITransaction transaction, string schemaName, string objectName)
 
static ObjectName ResolveObjectName (this ITransaction transaction, string objectName)
 
static ObjectName ResolveObjectName (this ITransaction transaction, DbObjectType objectType, ObjectName objectName)
 
static ObjectName ResolveObjectName (this ITransaction transaction, ObjectName objectName)
 
static void CreateSchema (this ITransaction transaction, SchemaInfo schemaInfo)
 
static void CreateSystemSchema (this ITransaction transaction)
 
static ObjectName ResolveTableName (this ITransaction transaction, ObjectName tableName)
 
static bool TableExists (this ITransaction transaction, ObjectName tableName)
 
static bool RealTableExists (this ITransaction transaction, ObjectName objName)
 
static ITable GetTable (this ITransaction transaction, ObjectName tableName)
 Tries to get an object with the given name formed as table. More...
 
static IMutableTable GetMutableTable (this ITransaction transaction, ObjectName tableName)
 
static TableInfo GetTableInfo (this ITransaction transaction, ObjectName tableName)
 
static string GetTableType (this ITransaction transaction, ObjectName tableName)
 
static void CreateTable (this ITransaction transaction, TableInfo tableInfo)
 
static void CreateTable (this ITransaction transaction, TableInfo tableInfo, bool temporary)
 
static void AlterTable (this ITransaction transaction, TableInfo tableInfo)
 Alters the table with the given name within this transaction to the specified table definition. More...
 
static bool DropTable (this ITransaction transaction, ObjectName tableName)
 
static SqlNumber SetTableId (this ITransaction transaction, ObjectName tableName, SqlNumber value)
 Sets the current value of a table native sequence. More...
 
static SqlNumber NextTableId (this ITransaction transaction, ObjectName tableName)
 Gets the next value of a table native sequence. More...
 
static string CurrentSchema (this ITransaction transaction)
 
static void CurrentSchema (this ITransaction transaction, string value)
 
static bool IgnoreIdentifiersCase (this ITransaction transaction)
 
static void IgnoreIdentifiersCase (this ITransaction transaction, bool value)
 
static bool AutoCommit (this ITransaction transaction)
 
static void AutoCommit (this ITransaction transaction, bool value)
 
static QueryParameterStyle ParameterStyle (this ITransaction transaction)
 
static void ParameterStyle (this ITransaction transaction, QueryParameterStyle value)
 
static bool ReadOnly (this ITransaction transaction)
 
static void ReadOnly (this ITransaction transaction, bool value)
 
static bool ErrorOnDirtySelect (this ITransaction transaction)
 
static void ErrorOnDirtySelect (this ITransaction transaction, bool value)
 
static void CreateSequence (this ITransaction transaction, SequenceInfo sequenceInfo)
 
static void CreateNativeSequence (this ITransaction transaction, ObjectName tableName)
 
static void RemoveNativeSequence (this ITransaction transaction, ObjectName tableName)
 
static bool DropSequence (this ITransaction transaction, ObjectName sequenceName)
 
static LockHandle LockTables (this ITransaction transaction, IEnumerable< ObjectName > tableNames, AccessType accessType, LockingMode mode)
 
static bool IsTableLocked (this ITransaction transaction, ITable table)
 

Static Package Functions

static IObjectManager GetObjectManager (this ITransaction transaction, DbObjectType objectType)
 
static IEnumerable< ITableSourceGetVisibleTables (this ITransaction transaction)
 
static void RemoveVisibleTable (this ITransaction transaction, TableSource table)
 
static void UpdateVisibleTable (this ITransaction transaction, TableSource tableSource, IIndexSet indexSet)
 
static IIndexSet GetIndexSetForTable (this ITransaction transaction, TableSource tableSource)
 

Static Private Member Functions

static void AssertNotReadOnly (this ITransaction transaction)
 
static IEnumerable< IObjectManagerGetObjectManagers (this ITransaction transaction)
 
static ObjectName ResolveReservedTableName (ObjectName tableName)
 

Detailed Description

Provides some convenience extension methods to ITransaction instances.

Definition at line 39 of file TransactionExtensions.cs.

Member Function Documentation

static bool Deveel.Data.Transactions.TransactionExtensions.AlterObject ( this ITransaction  transaction,
IObjectInfo  objInfo 
)
inlinestatic

Definition at line 125 of file TransactionExtensions.cs.

125  {
126  if (objInfo == null)
127  throw new ArgumentNullException("objInfo");
128 
129  var manager = transaction.GetObjectManager(objInfo.ObjectType);
130  if (manager == null)
131  throw new InvalidOperationException();
132 
133  if (manager.ObjectType != objInfo.ObjectType)
134  throw new ArgumentException();
135 
136  return manager.AlterObject(objInfo);
137  }
static void Deveel.Data.Transactions.TransactionExtensions.AlterTable ( this ITransaction  transaction,
TableInfo  tableInfo 
)
inlinestatic

Alters the table with the given name within this transaction to the specified table definition.

Parameters
transaction
tableInfo

This should only be called under an exclusive lock on the connection.

Exceptions
StatementExceptionIf the table does not exist.

Definition at line 346 of file TransactionExtensions.cs.

346  {
347  transaction.AlterObject(tableInfo);
348  }
static void Deveel.Data.Transactions.TransactionExtensions.AssertNotReadOnly ( this ITransaction  transaction)
inlinestaticprivate

Definition at line 40 of file TransactionExtensions.cs.

40  {
41  if (transaction.ReadOnly())
42  throw new TransactionException(TransactionErrorCodes.ReadOnly, "The transaction is in read-only mode.");
43  }
static bool Deveel.Data.Transactions.TransactionExtensions.AutoCommit ( this ITransaction  transaction)
inlinestatic

Definition at line 417 of file TransactionExtensions.cs.

417  {
418  return transaction.Context.AutoCommit();
419  }
static void Deveel.Data.Transactions.TransactionExtensions.AutoCommit ( this ITransaction  transaction,
bool  value 
)
inlinestatic

Definition at line 421 of file TransactionExtensions.cs.

421  {
422  transaction.Context.AutoCommit(value);
423  }
static void Deveel.Data.Transactions.TransactionExtensions.CreateNativeSequence ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 457 of file TransactionExtensions.cs.

457  {
458  transaction.CreateSequence(SequenceInfo.Native(tableName));
459  }
Provides the meta information about a ISequence configuring its operative behavior.
Definition: SequenceInfo.cs:28
static SequenceInfo Native(ObjectName tableName)
Creates an object that describes a native sequence for the table having the specified name...
static void Deveel.Data.Transactions.TransactionExtensions.CreateObject ( this ITransaction  transaction,
IObjectInfo  objInfo 
)
inlinestatic

Definition at line 109 of file TransactionExtensions.cs.

109  {
110  if (objInfo == null)
111  throw new ArgumentNullException("objInfo");
112 
113  var manager = transaction.GetObjectManager(objInfo.ObjectType);
114  if (manager == null)
115  throw new InvalidOperationException(String.Format("Could not find any manager for object type '{0}' configured for the system.", objInfo.ObjectType));
116 
117  if (manager.ObjectType != objInfo.ObjectType)
118  throw new ArgumentException(
119  String.Format("Could not create an object of type '{0}' with the manager '{1}' (supported '{2}' type)",
120  objInfo.ObjectType, manager.GetType().FullName, manager.ObjectType));
121 
122  manager.CreateObject(objInfo);
123  }
A long string in the system.
static void Deveel.Data.Transactions.TransactionExtensions.CreateSchema ( this ITransaction  transaction,
SchemaInfo  schemaInfo 
)
inlinestatic

Definition at line 203 of file TransactionExtensions.cs.

203  {
204  transaction.CreateObject(schemaInfo);
205  }
static void Deveel.Data.Transactions.TransactionExtensions.CreateSequence ( this ITransaction  transaction,
SequenceInfo  sequenceInfo 
)
inlinestatic

Definition at line 453 of file TransactionExtensions.cs.

453  {
454  transaction.CreateObject(sequenceInfo);
455  }
static void Deveel.Data.Transactions.TransactionExtensions.CreateSystem ( this ITransaction  transaction)
inlinestatic

Definition at line 47 of file TransactionExtensions.cs.

47  {
48  var managers = transaction.Context.ResolveAllServices<IObjectManager>();
49  foreach (var manager in managers) {
50  manager.Create();
51  }
52  }
void Create()
Initializes the manager into the underlying system.
Defines the contract for the business managers of database objects of a given type.
static void Deveel.Data.Transactions.TransactionExtensions.CreateSystemSchema ( this ITransaction  transaction)
inlinestatic

Definition at line 208 of file TransactionExtensions.cs.

208  {
209  transaction.CreateSystem();
210 
211  // TODO: get the configured default culture...
212  var culture = CultureInfo.CurrentCulture.Name;
213  var schemaInfo = new SchemaInfo(SystemSchema.Name, SchemaTypes.System);
214  schemaInfo.Culture = culture;
215 
216  transaction.CreateSchema(schemaInfo);
217  }
Describes the properties of a schema in a database system.
Definition: SchemaInfo.cs:39
static void Deveel.Data.Transactions.TransactionExtensions.CreateTable ( this ITransaction  transaction,
TableInfo  tableInfo 
)
inlinestatic

Definition at line 321 of file TransactionExtensions.cs.

321  {
322  CreateTable(transaction, tableInfo, false);
323  }
static void CreateTable(this ITransaction transaction, TableInfo tableInfo)
static void Deveel.Data.Transactions.TransactionExtensions.CreateTable ( this ITransaction  transaction,
TableInfo  tableInfo,
bool  temporary 
)
inlinestatic

Definition at line 325 of file TransactionExtensions.cs.

325  {
326  var tableManager = transaction.GetTableManager();
327  if (temporary) {
328  tableManager.CreateTemporaryTable(tableInfo);
329  } else {
330  tableManager.CreateTable(tableInfo);
331  }
332  }
static string Deveel.Data.Transactions.TransactionExtensions.CurrentSchema ( this ITransaction  transaction)
inlinestatic

Definition at line 401 of file TransactionExtensions.cs.

401  {
402  return transaction.Context.CurrentSchema();
403  }
static void Deveel.Data.Transactions.TransactionExtensions.CurrentSchema ( this ITransaction  transaction,
string  value 
)
inlinestatic

Definition at line 405 of file TransactionExtensions.cs.

405  {
406  transaction.Context.CurrentSchema(value);
407  }
static bool Deveel.Data.Transactions.TransactionExtensions.DropObject ( this ITransaction  transaction,
DbObjectType  objType,
ObjectName  objName 
)
inlinestatic

Definition at line 139 of file TransactionExtensions.cs.

139  {
140  var manager = transaction.GetObjectManager(objType);
141  if (manager == null)
142  return false;
143 
144  return manager.DropObject(objName);
145  }
static bool Deveel.Data.Transactions.TransactionExtensions.DropSequence ( this ITransaction  transaction,
ObjectName  sequenceName 
)
inlinestatic

Definition at line 465 of file TransactionExtensions.cs.

465  {
466  return transaction.DropObject(DbObjectType.Sequence, sequenceName);
467  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static bool Deveel.Data.Transactions.TransactionExtensions.DropTable ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 350 of file TransactionExtensions.cs.

350  {
351  return transaction.DropObject(DbObjectType.Table, tableName);
352  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static bool Deveel.Data.Transactions.TransactionExtensions.ErrorOnDirtySelect ( this ITransaction  transaction)
inlinestatic

Definition at line 441 of file TransactionExtensions.cs.

441  {
442  return transaction.Context.ErrorOnDirtySelect();
443  }
static void Deveel.Data.Transactions.TransactionExtensions.ErrorOnDirtySelect ( this ITransaction  transaction,
bool  value 
)
inlinestatic

Definition at line 445 of file TransactionExtensions.cs.

445  {
446  transaction.Context.ErrorOnDirtySelect(value);
447  }
static IDbObject Deveel.Data.Transactions.TransactionExtensions.FindObject ( this ITransaction  transaction,
ObjectName  objName 
)
inlinestatic

Definition at line 74 of file TransactionExtensions.cs.

74  {
75  return transaction.GetObjectManagers()
76  .Select(manager => manager.GetObject(objName))
77  .FirstOrDefault(obj => obj != null);
78  }
static IIndexSet Deveel.Data.Transactions.TransactionExtensions.GetIndexSetForTable ( this ITransaction  transaction,
TableSource  tableSource 
)
inlinestaticpackage

Definition at line 297 of file TransactionExtensions.cs.

297  {
298  return transaction.GetTableManager().GetIndexSetForTable(tableSource);
299  }
static IMutableTable Deveel.Data.Transactions.TransactionExtensions.GetMutableTable ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 301 of file TransactionExtensions.cs.

301  {
302  return transaction.GetTable(tableName) as IMutableTable;
303  }
An interface that defines contracts to alter the contents of a table.
static IDbObject Deveel.Data.Transactions.TransactionExtensions.GetObject ( this ITransaction  transaction,
DbObjectType  objType,
ObjectName  objName 
)
inlinestatic

Definition at line 80 of file TransactionExtensions.cs.

80  {
81  var manager = transaction.GetObjectManager(objType);
82  if (manager == null)
83  return null;
84 
85  return manager.GetObject(objName);
86  }
static IObjectManager Deveel.Data.Transactions.TransactionExtensions.GetObjectManager ( this ITransaction  transaction,
DbObjectType  objectType 
)
inlinestaticpackage

Definition at line 66 of file TransactionExtensions.cs.

66  {
67  return transaction.Context.ResolveService<IObjectManager>(objectType);
68  }
Defines the contract for the business managers of database objects of a given type.
static IEnumerable<IObjectManager> Deveel.Data.Transactions.TransactionExtensions.GetObjectManagers ( this ITransaction  transaction)
inlinestaticprivate

Definition at line 70 of file TransactionExtensions.cs.

70  {
71  return transaction.Context.ResolveAllServices<IObjectManager>();
72  }
Defines the contract for the business managers of database objects of a given type.
static ITable Deveel.Data.Transactions.TransactionExtensions.GetTable ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Tries to get an object with the given name formed as table.

Parameters
transactionThe transaction object.
tableNameThe name of the table to try to get.
Returns
Returns an instance of ITable if an object with the given name was found in the underlying transaction and it is of DbObjectType.Table and it is not null.

Definition at line 271 of file TransactionExtensions.cs.

271  {
272  tableName = ResolveReservedTableName(tableName);
273 
274  var tableStateHandler = transaction as ITableStateHandler;
275  if (tableStateHandler != null) {
276  if (tableName.Equals(SystemSchema.OldTriggerTableName, transaction.IgnoreIdentifiersCase()))
277  return tableStateHandler.TableState.OldDataTable;
278  if (tableName.Equals(SystemSchema.NewTriggerTableName, transaction.IgnoreIdentifiersCase()))
279  return tableStateHandler.TableState.NewDataTable;
280  }
281 
282  return (ITable) transaction.GetObject(DbObjectType.Table, tableName);
283  }
Defines the contract to access the data contained into a table of a database.
Definition: ITable.cs:40
override bool Equals(object obj)
Definition: ObjectName.cs:241
static ObjectName ResolveReservedTableName(ObjectName tableName)
ITable OldDataTable
The tUserContextTable object that represents the OLD table, if set.
OldNewTableState TableState
Gets an object that olds the state before and after a table event.
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static TableInfo Deveel.Data.Transactions.TransactionExtensions.GetTableInfo ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 305 of file TransactionExtensions.cs.

305  {
306  var tableManager = transaction.GetObjectManager(DbObjectType.Table) as TableManager;
307  if (tableManager == null)
308  throw new InvalidOperationException("No table manager was found.");
309 
310  return tableManager.GetTableInfo(tableName);
311  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static TableManager Deveel.Data.Transactions.TransactionExtensions.GetTableManager ( this ITransaction  transaction)
inlinestatic

Definition at line 54 of file TransactionExtensions.cs.

54  {
55  return (TableManager) transaction.Context.ResolveService<IObjectManager>(DbObjectType.Table);
56  }
Defines the contract for the business managers of database objects of a given type.
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static string Deveel.Data.Transactions.TransactionExtensions.GetTableType ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 313 of file TransactionExtensions.cs.

313  {
314  var tableManager = transaction.GetTableManager();
315  if (tableManager == null)
316  throw new InvalidOperationException("No table manager was found.");
317 
318  return tableManager.GetTableType(tableName);
319  }
static TriggerManager Deveel.Data.Transactions.TransactionExtensions.GetTriggerManager ( this ITransaction  transaction)
inlinestatic

Definition at line 58 of file TransactionExtensions.cs.

58  {
59  return transaction.Context.ResolveService<IObjectManager>(DbObjectType.Trigger) as TriggerManager;
60  }
Defines the contract for the business managers of database objects of a given type.
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static IEnumerable<ITableSource> Deveel.Data.Transactions.TransactionExtensions.GetVisibleTables ( this ITransaction  transaction)
inlinestaticpackage

Definition at line 285 of file TransactionExtensions.cs.

285  {
286  return transaction.GetTableManager().GetVisibleTables();
287  }
static bool Deveel.Data.Transactions.TransactionExtensions.IgnoreIdentifiersCase ( this ITransaction  transaction)
inlinestatic

Definition at line 409 of file TransactionExtensions.cs.

409  {
410  return transaction.Context.IgnoreIdentifiersCase();
411  }
static void Deveel.Data.Transactions.TransactionExtensions.IgnoreIdentifiersCase ( this ITransaction  transaction,
bool  value 
)
inlinestatic

Definition at line 413 of file TransactionExtensions.cs.

413  {
414  transaction.Context.IgnoreIdentifiersCase(value);
415  }
static bool Deveel.Data.Transactions.TransactionExtensions.IsTableLocked ( this ITransaction  transaction,
ITable  table 
)
inlinestatic

Definition at line 478 of file TransactionExtensions.cs.

478  {
479  var lockable = table as ILockable;
480  if (lockable == null)
481  return false;
482 
483  return transaction.Database.Locker.IsLocked(lockable);
484  }
static LockHandle Deveel.Data.Transactions.TransactionExtensions.LockTables ( this ITransaction  transaction,
IEnumerable< ObjectName tableNames,
AccessType  accessType,
LockingMode  mode 
)
inlinestatic

Definition at line 473 of file TransactionExtensions.cs.

473  {
474  var tables = tableNames.Select(transaction.GetTable).OfType<ILockable>();
475  return transaction.Database.Locker.Lock(tables.ToArray(), accessType, mode);
476  }
static SqlNumber Deveel.Data.Transactions.TransactionExtensions.NextTableId ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Gets the next value of a table native sequence.

Parameters
transaction
tableName
Returns
Returns the next value of the sequence for the given table.

Definition at line 387 of file TransactionExtensions.cs.

387  {
388  transaction.AssertNotReadOnly();
389 
390  var tableManager = transaction.GetTableManager();
391  if (tableManager == null)
392  throw new InvalidOperationException();
393 
394  return tableManager.NextUniqueId(tableName);
395  }
static bool Deveel.Data.Transactions.TransactionExtensions.ObjectExists ( this ITransaction  transaction,
ObjectName  objName 
)
inlinestatic

Definition at line 88 of file TransactionExtensions.cs.

88  {
89  return transaction.GetObjectManagers()
90  .Any(manager => manager.ObjectExists(objName));
91  }
static bool Deveel.Data.Transactions.TransactionExtensions.ObjectExists ( this ITransaction  transaction,
DbObjectType  objType,
ObjectName  objName 
)
inlinestatic

Definition at line 93 of file TransactionExtensions.cs.

93  {
94  var manager = transaction.GetObjectManager(objType);
95  if (manager == null)
96  return false;
97 
98  return manager.ObjectExists(objName);
99  }
static QueryParameterStyle Deveel.Data.Transactions.TransactionExtensions.ParameterStyle ( this ITransaction  transaction)
inlinestatic

Definition at line 425 of file TransactionExtensions.cs.

425  {
426  return transaction.Context.ParameterStyle();
427  }
static void Deveel.Data.Transactions.TransactionExtensions.ParameterStyle ( this ITransaction  transaction,
QueryParameterStyle  value 
)
inlinestatic

Definition at line 429 of file TransactionExtensions.cs.

429  {
430  transaction.Context.ParameterStyle(value);
431  }
static bool Deveel.Data.Transactions.TransactionExtensions.ReadOnly ( this ITransaction  transaction)
inlinestatic

Definition at line 433 of file TransactionExtensions.cs.

433  {
434  return transaction.Context.ReadOnly();
435  }
static void Deveel.Data.Transactions.TransactionExtensions.ReadOnly ( this ITransaction  transaction,
bool  value 
)
inlinestatic

Definition at line 437 of file TransactionExtensions.cs.

437  {
438  transaction.Context.ReadOnly(value);
439  }
static bool Deveel.Data.Transactions.TransactionExtensions.RealObjectExists ( this ITransaction  transaction,
DbObjectType  objType,
ObjectName  objName 
)
inlinestatic

Definition at line 101 of file TransactionExtensions.cs.

101  {
102  var manager = transaction.GetObjectManager(objType);
103  if (manager == null)
104  return false;
105 
106  return manager.RealObjectExists(objName);
107  }
static bool Deveel.Data.Transactions.TransactionExtensions.RealTableExists ( this ITransaction  transaction,
ObjectName  objName 
)
inlinestatic

Definition at line 257 of file TransactionExtensions.cs.

257  {
258  return transaction.RealObjectExists(DbObjectType.Table, objName);
259  }
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static void Deveel.Data.Transactions.TransactionExtensions.RemoveNativeSequence ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 461 of file TransactionExtensions.cs.

461  {
462  transaction.DropSequence(tableName);
463  }
static void Deveel.Data.Transactions.TransactionExtensions.RemoveVisibleTable ( this ITransaction  transaction,
TableSource  table 
)
inlinestaticpackage

Definition at line 289 of file TransactionExtensions.cs.

289  {
290  transaction.GetTableManager().RemoveVisibleTable(table);
291  }
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveObjectName ( this ITransaction  transaction,
string  schemaName,
string  objectName 
)
inlinestatic

Definition at line 147 of file TransactionExtensions.cs.

147  {
148  if (String.IsNullOrEmpty(objectName))
149  throw new ArgumentNullException("objectName");
150 
151  if (String.IsNullOrEmpty(schemaName))
152  schemaName = transaction.CurrentSchema();
153 
154  var objName = new ObjectName(new ObjectName(schemaName), objectName);
155 
156  // Special case for OLD and NEW tables
157  if (String.Compare(objectName, "OLD", StringComparison.OrdinalIgnoreCase) == 0)
158  return SystemSchema.OldTriggerTableName;
159  if (String.Compare(objectName, "NEW", StringComparison.OrdinalIgnoreCase) == 0)
160  return SystemSchema.NewTriggerTableName;
161 
162  bool found = false;
163 
164  foreach (var manager in transaction.GetObjectManagers()) {
165  if (manager.ObjectExists(objName)) {
166  if (found)
167  throw new ArgumentException(String.Format("The name '{0}' is an ambiguous match.", objectName));
168 
169  found = true;
170  }
171  }
172 
173  if (!found)
174  throw new ObjectNotFoundException(objectName);
175 
176  return objName;
177  }
A long string in the system.
Describes the name of an object within a database.
Definition: ObjectName.cs:44
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveObjectName ( this ITransaction  transaction,
string  objectName 
)
inlinestatic

Definition at line 179 of file TransactionExtensions.cs.

179  {
180  return transaction.ResolveObjectName(transaction.CurrentSchema(), objectName);
181  }
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveObjectName ( this ITransaction  transaction,
DbObjectType  objectType,
ObjectName  objectName 
)
inlinestatic

Definition at line 183 of file TransactionExtensions.cs.

183  {
184  var manager = transaction.GetObjectManager(objectType);
185  if (manager == null)
186  return objectName;
187 
188  return manager.ResolveName(objectName, transaction.IgnoreIdentifiersCase());
189  }
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveObjectName ( this ITransaction  transaction,
ObjectName  objectName 
)
inlinestatic

Definition at line 191 of file TransactionExtensions.cs.

191  {
192  var ignoreCase = transaction.IgnoreIdentifiersCase();
193 
194  return transaction.GetObjectManagers()
195  .Select(manager => manager.ResolveName(objectName, ignoreCase))
196  .FirstOrDefault(resolved => resolved != null);
197  }
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveReservedTableName ( ObjectName  tableName)
inlinestaticprivate

Definition at line 223 of file TransactionExtensions.cs.

223  {
224  // We do not allow tables to be created with a reserved name
225  var name = tableName.Name;
226 
227  if (String.Compare(name, "OLD", StringComparison.OrdinalIgnoreCase) == 0)
228  return SystemSchema.OldTriggerTableName;
229  if (String.Compare(name, "NEW", StringComparison.OrdinalIgnoreCase) == 0)
230  return SystemSchema.NewTriggerTableName;
231 
232  return tableName;
233  }
A long string in the system.
string Name
Gets the name of the object being referenced.
Definition: ObjectName.cs:108
static ObjectName Deveel.Data.Transactions.TransactionExtensions.ResolveTableName ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 235 of file TransactionExtensions.cs.

235  {
236  if (tableName == null)
237  return null;
238 
239  if (tableName.Parent == null)
240  tableName = new ObjectName(new ObjectName(transaction.CurrentSchema()), tableName.Name);
241 
242  // We do not allow tables to be created with a reserved name
243  var name = tableName.Name;
244 
245  if (String.Compare(name, "OLD", StringComparison.OrdinalIgnoreCase) == 0)
246  return SystemSchema.OldTriggerTableName;
247  if (String.Compare(name, "NEW", StringComparison.OrdinalIgnoreCase) == 0)
248  return SystemSchema.NewTriggerTableName;
249 
250  return transaction.ResolveObjectName(DbObjectType.Table, tableName);
251  }
A long string in the system.
Describes the name of an object within a database.
Definition: ObjectName.cs:44
ObjectName Parent
Gets the parent reference of the current one, if any or null if none.
Definition: ObjectName.cs:99
string Name
Gets the name of the object being referenced.
Definition: ObjectName.cs:108
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static SqlNumber Deveel.Data.Transactions.TransactionExtensions.SetTableId ( this ITransaction  transaction,
ObjectName  tableName,
SqlNumber  value 
)
inlinestatic

Sets the current value of a table native sequence.

Parameters
transaction
tableNameThe table name.
valueThe current value of the native sequence.
See also
ISequence, ISequenceManager
Returns
Returns the current table sequence value after the set.
Exceptions
ObjectNotFoundExceptionIf it was not possible to find any table having the given tableName name.

Definition at line 369 of file TransactionExtensions.cs.

369  {
370  transaction.AssertNotReadOnly();
371 
372  var tableManager = transaction.GetTableManager();
373  if (tableManager == null)
374  throw new InvalidOperationException();
375 
376  return tableManager.SetUniqueId(tableName, value);
377  }
static bool Deveel.Data.Transactions.TransactionExtensions.TableExists ( this ITransaction  transaction,
ObjectName  tableName 
)
inlinestatic

Definition at line 253 of file TransactionExtensions.cs.

253  {
254  return transaction.ObjectExists(DbObjectType.Table, ResolveReservedTableName(tableName));
255  }
static ObjectName ResolveReservedTableName(ObjectName tableName)
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
static void Deveel.Data.Transactions.TransactionExtensions.UpdateVisibleTable ( this ITransaction  transaction,
TableSource  tableSource,
IIndexSet  indexSet 
)
inlinestaticpackage

Definition at line 293 of file TransactionExtensions.cs.

293  {
294  transaction.GetTableManager().UpdateVisibleTable(tableSource, indexSet);
295  }

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