Gets the table contained at the given offset within the context.
191 var table =
transaction.GetTable(SystemSchema.SequenceInfoTableName);
195 foreach (var row
in table) {
196 var seqType = row.GetValue(3);
199 rowIndex = row.RowId.RowNumber;
208 throw new ArgumentOutOfRangeException(
"offset");
210 var seqId = table.GetValue(rowIndex, 0);
211 var schema = ObjectName.Parse(table.GetValue(rowIndex, 1).Value.ToString());
212 var name = table.GetValue(rowIndex, 2).Value.ToString();
214 var tableName =
new ObjectName(schema, name);
217 var seqTable =
transaction.GetTable(SystemSchema.SequenceTableName);
219 var index = seqTable.GetIndex(0);
220 var list = index.SelectEqual(seqId);
223 throw new Exception(
"No SEQUENCE table entry for sequence.");
225 int seqRowI = list.First();
231 DataObject lastValue;
234 if (sequence == null)
235 throw new ObjectNotFoundException(tableName);
237 lastValue = DataObject.Number(sequence.GetCurrentValue());
238 }
catch (Exception) {
239 lastValue = DataObject.BigInt(-1);
246 var topValue = seqTable.GetValue(seqRowI, 1);
247 var incrementBy = seqTable.GetValue(seqRowI, 2);
248 var minValue = seqTable.GetValue(seqRowI, 3);
249 var maxValue = seqTable.GetValue(seqRowI, 4);
250 var start = seqTable.GetValue(seqRowI, 5);
251 var cache = seqTable.GetValue(seqRowI, 6);
252 var cycle = seqTable.GetValue(seqRowI, 7);
258 CurrentValue = currentValue,
259 Increment = incrementBy,
SqlNumber GetCurrentValue(ObjectName name)
static TableInfo CreateTableInfo(ObjectName schema, string name)
IDatabase Database
Gets the database this transaction belongs to.
ISequence GetSequence(ObjectName sequenceName)
readonly SequenceManager manager
new IDatabaseContext Context
Gets the context that contains this database.
The offset of the last value of the range.
readonly ITransaction transaction
static readonly DataObject OneValue
A static TObject that represents numeric 1.