Class DBUtil
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.DBUtil
-
public class DBUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description DBUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
close(Connection connection)
static void
close(ResultSet rs)
static void
close(ResultSet rs, Statement st)
static void
close(Statement st)
static Set<String>
getAllTableNames()
Gets all table names.static int
getDateFieldLength()
static int
getNextId(String identifierName)
Return a new unique identifier value referenced by a name.static int
getNextId(String identifierName, String tableFieldIdentifierName)
Return a new unique identifier value referenced by a name.static int
getTextAreaLength()
static int
getTextFieldLength()
static String
getUniqueId()
Returns a new unique identifier of type string.static Connection
openConnection()
Opens a new connection to the Silverpeas database.static void
rollback(Connection connection)
String
toString()
-
-
-
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)
-
-