Class DBUtil


  • public class DBUtil
    extends Object
    • Constructor Detail

      • DBUtil

        public DBUtil()
    • Method Detail

      • getDateFieldLength

        public static int getDateFieldLength()
        Returns:
        the DateFieldLength
      • getTextAreaLength

        public static int getTextAreaLength()
        Returns:
        the TextAreaLength
      • getTextFieldLength

        public static int getTextFieldLength()
        Returns:
        the TextFieldLength
      • openConnection

        public static Connection openConnection()
                                         throws SQLException
        Opens a new connection to the Silverpeas database.
        Returns:
        a new connection to the database.
        Throws:
        SQLException - if the connection cannot be opened.
      • getUniqueId

        public static String getUniqueId()
        Returns a new unique identifier of type string.
        Returns:
        a new unique string identifier.
      • getNextId

        public static int getNextId​(String identifierName)
        Return a new unique identifier value referenced by a name.
        Parameters:
        identifierName - a name that does not correspond to something into persistence, but the caller needs to handle unique identifiers for a resource.
        Returns:
        a unique id.
      • getNextId

        public static int getNextId​(String identifierName,
                                    String tableFieldIdentifierName)
        Return a new unique identifier value referenced by a name.
        Parameters:
        identifierName - a name of an identifier can be the name of an existing table or a name that does not correspond to something into persistence, but the caller needs to handle unique identifiers for a resource.
        tableFieldIdentifierName - the field name of the table name represented by identifierName parameter that permits to initialize the first value of unique identifier for the table in case of it is not yet referenced into the uniqueId table. If this value is not defined, the identifierName parameter is not considered as a table name.
        Returns:
        a unique id.
      • close

        public static void close​(Statement st)
      • close

        public static void close​(ResultSet rs)
      • close

        public static void close​(Connection connection)
      • rollback

        public static void rollback​(Connection connection)
      • getAllTableNames

        public static Set<String> getAllTableNames()
        Gets all table names.
        Returns:
        all the table name of the database.