Package org.nuxeo.ecm.core.storage.sql
Class DatabaseHelper
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.DatabaseHelper
-
- Direct Known Subclasses:
DatabaseDB2
,DatabaseH2
,DatabaseMySQL
,DatabaseOracle
,DatabasePostgreSQL
,DatabaseSQLServer
public abstract class DatabaseHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static DatabaseHelper
DATABASE
static String
DATABASE_PROPERTY
String
databaseName
static String
DB_CLASS_NAME_BASE
static String
DB_DEFAULT
static String
DB_PROPERTY
static String
DEF_ID_TYPE
static String
DEFAULT_DATABASE_NAME
protected static Class<? extends BinaryManager>
defaultBinaryManager
static String
DRIVER_PROPERTY
static String
ID_TYPE_PROPERTY
protected Error
owner
static String
PASSWORD_PROPERTY
static String
PORT_PROPERTY
static String
SERVER_PROPERTY
static String
URL_PROPERTY
static String
USER_PROPERTY
-
Constructor Summary
Constructors Constructor Description DatabaseHelper()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static void
doOnAllTables(Connection connection, String catalog, String schemaPattern, String statement)
Executes one statement on all the tables in a database.protected static void
executeSql(Statement st, String sql)
static Connection
getConnection(String url, String user, String password)
Gets a database connection, retrying if the server says it's overloaded.abstract String
getDeploymentContrib()
int
getRecursiveRemovalDepthLimit()
For databases that fail to cascade deletes beyond a certain depth.abstract RepositoryDescriptor
getRepositoryDescriptor()
static void
setBinaryManager(Class<? extends BinaryManager> binaryManagerClass, String key)
static void
setDatabaseForTests(String className)
Sets the database backend used for VCS unit tests.void
setDatabaseName(String name)
protected void
setOwner()
static String
setProperty(String name, String def)
static String
setSystemProperty(String name, String def)
void
setUp()
void
sleepForFulltext()
For databases that do asynchronous fulltext indexing, sleep a bit.boolean
supportsArrayColumns()
boolean
supportsClustering()
For databases that don't support clustering.boolean
supportsFulltextSearch()
boolean
supportsMultipleFulltextIndexes()
boolean
supportsSequenceId()
Whether this database supports "sequence" as an id type.boolean
supportsSoftDelete()
boolean
supportsXA()
void
tearDown()
-
-
-
Field Detail
-
DB_PROPERTY
public static final String DB_PROPERTY
- See Also:
- Constant Field Values
-
DB_DEFAULT
public static final String DB_DEFAULT
- See Also:
- Constant Field Values
-
DEF_ID_TYPE
public static final String DEF_ID_TYPE
- See Also:
- Constant Field Values
-
DATABASE
public static DatabaseHelper DATABASE
-
DB_CLASS_NAME_BASE
public static final String DB_CLASS_NAME_BASE
- See Also:
- Constant Field Values
-
defaultBinaryManager
protected static final Class<? extends BinaryManager> defaultBinaryManager
-
DRIVER_PROPERTY
public static final String DRIVER_PROPERTY
- See Also:
- Constant Field Values
-
URL_PROPERTY
public static final String URL_PROPERTY
- See Also:
- Constant Field Values
-
SERVER_PROPERTY
public static final String SERVER_PROPERTY
- See Also:
- Constant Field Values
-
PORT_PROPERTY
public static final String PORT_PROPERTY
- See Also:
- Constant Field Values
-
DATABASE_PROPERTY
public static final String DATABASE_PROPERTY
- See Also:
- Constant Field Values
-
USER_PROPERTY
public static final String USER_PROPERTY
- See Also:
- Constant Field Values
-
PASSWORD_PROPERTY
public static final String PASSWORD_PROPERTY
- See Also:
- Constant Field Values
-
ID_TYPE_PROPERTY
public static final String ID_TYPE_PROPERTY
- See Also:
- Constant Field Values
-
owner
protected Error owner
-
DEFAULT_DATABASE_NAME
public static final String DEFAULT_DATABASE_NAME
- See Also:
- Constant Field Values
-
databaseName
public String databaseName
-
-
Method Detail
-
setDatabaseName
public void setDatabaseName(String name)
-
setDatabaseForTests
public static void setDatabaseForTests(String className)
Sets the database backend used for VCS unit tests.
-
getConnection
public static Connection getConnection(String url, String user, String password) throws SQLException
Gets a database connection, retrying if the server says it's overloaded.- Throws:
SQLException
- Since:
- 5.9.3
-
doOnAllTables
public static void doOnAllTables(Connection connection, String catalog, String schemaPattern, String statement) throws SQLException
Executes one statement on all the tables in a database.- Throws:
SQLException
-
executeSql
protected static void executeSql(Statement st, String sql) throws SQLException
- Throws:
SQLException
-
setUp
public void setUp() throws SQLException
- Throws:
SQLException
-
setOwner
protected void setOwner()
-
tearDown
public void tearDown() throws SQLException
- Throws:
SQLException
-
setBinaryManager
public static void setBinaryManager(Class<? extends BinaryManager> binaryManagerClass, String key)
-
getDeploymentContrib
public abstract String getDeploymentContrib()
-
getRepositoryDescriptor
public abstract RepositoryDescriptor getRepositoryDescriptor()
-
sleepForFulltext
public void sleepForFulltext()
For databases that do asynchronous fulltext indexing, sleep a bit.
-
getRecursiveRemovalDepthLimit
public int getRecursiveRemovalDepthLimit()
For databases that fail to cascade deletes beyond a certain depth.
-
supportsClustering
public boolean supportsClustering()
For databases that don't support clustering.
-
supportsMultipleFulltextIndexes
public boolean supportsMultipleFulltextIndexes()
-
supportsFulltextSearch
public boolean supportsFulltextSearch()
- Since:
- 11.1
-
supportsXA
public boolean supportsXA()
-
supportsSoftDelete
public boolean supportsSoftDelete()
-
supportsSequenceId
public boolean supportsSequenceId()
Whether this database supports "sequence" as an id type.- Since:
- 5.9.3
-
supportsArrayColumns
public boolean supportsArrayColumns()
-
-