Example #1
0
 public int update() {
   session.getUser().checkAdmin();
   session.commit(true);
   Database db = session.getDatabase();
   Sequence sequence = getSchema().findSequence(sequenceName);
   if (sequence == null) {
     if (!ifExists) {
       throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);
     }
   } else {
     if (sequence.getBelongsToTable()) {
       throw DbException.get(ErrorCode.SEQUENCE_BELONGS_TO_A_TABLE_1, sequenceName);
     }
     db.removeSchemaObject(session, sequence);
   }
   return 0;
 }
 private void removeSequence(Sequence sequence) {
   if (sequence != null) {
     table.removeSequence(sequence);
     sequence.setBelongsToTable(false);
     Database db = session.getDatabase();
     db.removeSchemaObject(session, sequence);
   }
 }