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

Static Public Member Functions

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

Detailed Description

Definition at line 23 of file QueryExtensions.cs.

Member Function Documentation

static SqlNumber Deveel.Data.Sql.Sequences.QueryExtensions.GetCurrentValue ( this IQuery  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 62 of file QueryExtensions.cs.

62  {
63  var sequence = context.GetSequence(sequenceName);
64  if (sequence == null)
65  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
66 
67  return sequence.GetCurrentValue();
68  }
A long string in the system.
static SqlNumber Deveel.Data.Sql.Sequences.QueryExtensions.GetNextValue ( this IQuery  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 41 of file QueryExtensions.cs.

41  {
42  var sequence = context.GetSequence(sequenceName);
43  if (sequence == null)
44  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
45 
46  return sequence.NextValue();
47  }
A long string in the system.
static ISequence Deveel.Data.Sql.Sequences.QueryExtensions.GetSequence ( this IQuery  context,
ObjectName  sequenceName 
)
inlinestatic

Definition at line 24 of file QueryExtensions.cs.

24  {
25  return context.GetObject(DbObjectType.Sequence, sequenceName, AccessType.Read) as ISequence;
26  }
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.QueryExtensions.SetCurrentValue ( this IQuery  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 80 of file QueryExtensions.cs.

80  {
81  var sequence = context.GetSequence(sequenceName);
82  if (sequence == null)
83  throw new InvalidOperationException(String.Format("Sequence {0} was not found.", sequenceName));
84 
85  sequence.SetValue(value);
86  }
A long string in the system.

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