package fr.dyade.aaa.util;

import java.sql.Connection;
import java.sql.SQLException;

public class XDBConnection extends WrappedConnection {
  public XDBConnection(Connection connection) {
    super(connection);
  }

  private static boolean disconnected = false;

  public static void disconnect(boolean disconnect) {
    disconnected = disconnect;
  }
  
  @Override
  Connection connection() throws SQLException {
    if (disconnected) {
      throw new SQLException("Connection disconnected");
    } else {
      return connection;
    }
  }
}
