Class DatabaseUtil

java.lang.Object
com.atlassian.jira.database.DatabaseUtil

public class DatabaseUtil extends Object
  • Constructor Details

    • DatabaseUtil

      public DatabaseUtil()
  • Method Details

    • closeQuietly

      public static void closeQuietly(@Nullable Connection con)
      Closes the given connection if any. If null is passed, it does nothing and if SQLExceptions happen on close, they are swallowed.
      Parameters:
      con - a Connection to be closed, potentially null
    • closeQuietly

      public static void closeQuietly(@Nullable Statement stmt)
      Closes the given Statement if any. If null is passed, it does nothing and if SQLExceptions happen on close, they are swallowed.
      Parameters:
      stmt - a Statement to be closed, potentially null
    • closeQuietly

      public static void closeQuietly(@Nullable ResultSet rs)
      Closes the given ResultSet if any. If null is passed, it does nothing and if SQLExceptions happen on close, they are swallowed.
      Parameters:
      rs - a ResultSet to be closed, potentially null
    • booleanToChar1

      public static String booleanToChar1(Boolean indicator)
      Converts a boolean value into a String value to be stored in a CHAR(1) DB column.

      This is useful when using the OfBiz "indicator" field-type to store a boolean flag.

      Parameters:
      indicator - the Boolean value
      Returns:
      "Y", "N", or null accordingly.
    • cleanOfBizSchema

      public static void cleanOfBizSchema()
      Programmer's note: This method was called kickOfBizInTheGuts. Came from DatabaseLauncher. Leaving a comment to provide historical accuracy. This method reruns ofBiz DDL tasks. It creates missing indexes, tables, etc...