Enum Class DBCodeResolver

java.lang.Object
java.lang.Enum<DBCodeResolver>
overit.geocall.sql.DBCodeResolver
All Implemented Interfaces:
Serializable, Comparable<DBCodeResolver>, Constable

public enum DBCodeResolver extends Enum<DBCodeResolver>
Utility class that resolve a sql error code depending on the connection used.
  • Enum Constant Details

  • Method Details

    • values

      public static DBCodeResolver[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DBCodeResolver valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromType

      public static DBCodeResolver fromType(DBType dbType)
      Returns a DBCodeResolver depending on the connection used
      Parameters:
      dbType - the DBType of the connection
      Returns:
      the correct DBCodeResolver
    • fromDriver

      public static DBCodeResolver fromDriver(String driver)
      Returns a DBCodeResolver depending on the driver used
      Parameters:
      driver - the string representing the driver of the db
      Returns:
      the correct DBCodeResolver
    • isInvalidCredentials

      public boolean isInvalidCredentials(SQLException e)
      Returns true if the SQLException is caused by an invalid credential, false otherwise
      Parameters:
      e - the SQLException to test
      Returns:
      true if the SQLException is caused by an invalid credential, false otherwise
    • isUniqueConstraintsViolated

      public boolean isUniqueConstraintsViolated(SQLException e)
      Returns true if the SQLException is caused by a unique constraints violated, false otherwise
      Parameters:
      e - the SQLException to test
      Returns:
      true if the SQLException is caused by a unique constraints violated, false otherwise