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

Static Public Member Functions

static ISequence GetSequence (this IQueryContext context, ObjectName sequenceName)
 
static SqlNumber GetNextValue (this IQueryContext context, ObjectName sequenceName)
 Increments the sequence and returns the computed value. More...
 
static SqlNumber GetCurrentValue (this IQueryContext context, ObjectName sequenceName)
 Gets the current value of the sequence. More...
 
static void SetCurrentValue (this IQueryContext context, ObjectName sequenceName, SqlNumber value)
 Sets the current value of the sequence, overriding the increment mechanism in place. More...
 

Detailed Description

Definition at line 7 of file QueryContext.Sequences.cs.

Member Function Documentation

static SqlNumber Deveel.Data.Sql.Sequences.QueryContext.GetCurrentValue ( this IQueryContext  context,
ObjectName  sequenceName 
)
inlinestatic

Gets the current value of the sequence.

Parameters
context
sequenceNameThe name of the sequence whose current value must be obtained.
Returns
Returns a SqlNumber that represents the current value of the sequence identified by the given name.
Exceptions
ObjectNotFoundExceptionIf none sequence was found for the given sequenceName .

Definition at line 46 of file QueryContext.Sequences.cs.

46  {
47  var sequence = context.GetSequence(sequenceName);
48  if (sequence == null)
49  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
50 
51  return sequence.GetCurrentValue();
52  }
A long string in the system.
static SqlNumber Deveel.Data.Sql.Sequences.QueryContext.GetNextValue ( this IQueryContext  context,
ObjectName  sequenceName 
)
inlinestatic

Increments the sequence and returns the computed value.

Parameters
context
sequenceNameThe name of the sequence to increment and whose incremented value must be returned.
Returns
Returns a SqlNumber that represents the result of the increment operation over the sequence identified by the given name.
Exceptions
ObjectNotFoundExceptionIf none sequence was found for the given sequenceName .

Definition at line 25 of file QueryContext.Sequences.cs.

25  {
26  var sequence = context.GetSequence(sequenceName);
27  if (sequence == null)
28  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
29 
30  return sequence.NextValue();
31  }
A long string in the system.
static ISequence Deveel.Data.Sql.Sequences.QueryContext.GetSequence ( this IQueryContext  context,
ObjectName  sequenceName 
)
inlinestatic

Definition at line 8 of file QueryContext.Sequences.cs.

8  {
9  return context.GetObject(DbObjectType.Sequence, sequenceName, AccessType.Read) as ISequence;
10  }
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.Sequences.QueryContext.SetCurrentValue ( this IQueryContext  context,
ObjectName  sequenceName,
SqlNumber  value 
)
inlinestatic

Sets the current value of the sequence, overriding the increment mechanism in place.

Parameters
sequenceNameThe name of the sequence whose current state to be set.
valueThe numeric value to set.
Exceptions
ObjectNotFoundExceptionIf none sequence was found for the given sequenceName .

Definition at line 64 of file QueryContext.Sequences.cs.

64  {
65  var sequence = context.GetSequence(sequenceName);
66  if (sequence == null)
67  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
68 
69  sequence.SetValue(value);
70  }
A long string in the system.

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