DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SequenceInfo.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 
19 using Deveel.Data.Sql.Objects;
20 
21 namespace Deveel.Data.Sql.Sequences {
28  public sealed class SequenceInfo : IObjectInfo {
29  private SequenceInfo(ObjectName sequenceName, SequenceType sequenceType) {
30  if (sequenceName == null)
31  throw new ArgumentNullException("sequenceName");
32 
33  SequenceName = sequenceName;
34  Type = sequenceType;
35  }
36 
47  public SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, long cache)
48  : this(sequenceName, startValue, increment, minValue, maxValue, cache, true) {
49  }
50 
62  public SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, bool cycle)
63  : this(sequenceName, startValue, increment, minValue, maxValue, 256, cycle) {
64  }
65 
78  public SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, long cache, bool cycle)
79  : this(sequenceName, SequenceType.Normal) {
80  StartValue = startValue;
81  Increment = increment;
82  MinValue = minValue;
83  MaxValue = maxValue;
84  Cache = cache;
85  Cycle = cycle;
86  }
87 
89  get { return DbObjectType.Sequence; }
90  }
91 
92  public ObjectName SequenceName { get; private set; }
93 
95  get { return SequenceName; }
96  }
97 
98  public SequenceType Type { get; private set; }
99 
103  public SqlNumber StartValue { get; private set; }
104 
111  public SqlNumber Increment { get; private set; }
112 
116  public SqlNumber MinValue { get; private set; }
117 
122  public SqlNumber MaxValue { get; private set; }
123 
127  public long Cache { get; private set; }
128 
135  public bool Cycle { get; private set; }
136 
143  public static SequenceInfo Native(ObjectName tableName) {
144  return new SequenceInfo(tableName, SequenceType.Native);
145  }
146  }
147 }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, bool cycle)
Constructs a new object with the information given
Definition: SequenceInfo.cs:62
Denotes a sequence created by the user and that has a specified incremental factor, and other attributes.
A user-defined TYPE that holds complex objects in a database column.
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...
SequenceInfo(ObjectName sequenceName, SequenceType sequenceType)
Definition: SequenceInfo.cs:29
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
SequenceType
The form of a ISequence object in a transaction.
Definition: SequenceType.cs:26
SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, long cache, bool cycle)
Constructs a new object with the information given
Definition: SequenceInfo.cs:78
SequenceInfo(ObjectName sequenceName, SqlNumber startValue, SqlNumber increment, SqlNumber minValue, SqlNumber maxValue, long cache)
Constructs a new object with the information given
Definition: SequenceInfo.cs:47