public bool SequenceExists(ObjectName sequenceName)
{
// If the Sequence or SequenceInfo tables don't exist then
// we can't create the sequence generator
if (!Transaction.TableExists(SequenceTableName) ||
!Transaction.TableExists(SequenceInfoTableName)) {
throw new Exception("System sequence tables do not exist.");
}
// The SEQUENCE and SEQUENCE_INFO table
var seq = Transaction.GetMutableTable(SequenceTableName);
var seqi = Transaction.GetMutableTable(SequenceInfoTableName);
return seqi.SelectRowsEqual(1, Field.VarChar(sequenceName.ParentName), 2, Field.VarChar(sequenceName.Name)).Any();
}