final int next_value = 15;
//
Iterator it;
Object[] row;
NumberSequence sequence;
it = database.schemaManager.databaseObjectIterator(
SchemaObject.SEQUENCE);
while (it.hasNext()) {
sequence = (NumberSequence) it.next();
if (!session.getGrantee().isAccessible(sequence)) {
continue;
}
row = t.getEmptyRowData();
NumberType type = (NumberType) sequence.getDataType();
int radix =
(type.typeCode == Types.SQL_NUMERIC || type.typeCode == Types
.SQL_DECIMAL) ? 10
: 2;
row[sequence_catalog] = database.getCatalogName().name;
row[sequence_schema] = sequence.getSchemaName().name;
row[sequence_name] = sequence.getName().name;
row[data_type] = sequence.getDataType().getFullNameString();
row[numeric_precision] =
ValuePool.getInt((int) type.getPrecision());
row[numeric_precision_radix] = ValuePool.getInt(radix);
row[numeric_scale] = ValuePool.INTEGER_0;
row[maximum_value] = String.valueOf(sequence.getMaxValue());
row[minimum_value] = String.valueOf(sequence.getMinValue());
row[increment] = String.valueOf(sequence.getIncrement());
row[cycle_option] = sequence.isCycle() ? "YES"
: "NO";
row[declared_data_type] = row[data_type];
row[declared_numeric_precision] = row[numeric_precision];
row[declared_numeric_scale] = row[declared_numeric_scale];
row[start_with] = String.valueOf(sequence.getStartValue());
row[next_value] = String.valueOf(sequence.peek());
t.insertSys(session, store, row);
}
return t;