Enum RDBDocumentStoreDB
- java.lang.Object
-
- java.lang.Enum<RDBDocumentStoreDB>
-
- org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreDB
-
- All Implemented Interfaces:
Serializable
,Comparable<RDBDocumentStoreDB>
public enum RDBDocumentStoreDB extends Enum<RDBDocumentStoreDB>
Defines variation in the capabilities of different RDBs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RDBDocumentStoreDB.FETCHFIRSTSYNTAX
-
Field Summary
Fields Modifier and Type Field Description protected String
description
protected RDBCommonVendorSpecificCode
vendorCode
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
checkVersion(DatabaseMetaData md)
Check the database brand and versionprotected String
extractFields(ResultSet rs, String indexStats)
@NotNull Map<String,String>
getAdditionalDiagnostics(RDBConnectionHandler ch, String tableName)
Map<String,String>
getAdditionalStatistics(RDBConnectionHandler ch, String catalog, String tableName)
Returns additional DB-specific statistics, augmenting the return value ofRDBDocumentStore.getStats()
.String
getBigintType()
RDBJDBCTools.PreparedStatementComponent
getConcatQuery(String appendData, int dataOctetLimit)
Returns the CONCAT function or its equivalent function or sub-query.String
getCurrentTimeStampInSecondsSyntax()
Query syntax for current time in ms since the epochRDBDocumentStoreDB.FETCHFIRSTSYNTAX
getFetchFirstSyntax()
Query syntax for "FETCH FIRST"List<String>
getIndexCreationStatements(String tableName, int level)
@NotNull String
getInitializationStatement()
Query for any required initialization of the DB.String
getModifiedIndexStatement(String tableName)
String
getSmallintType()
String
getTableCreationStatement(String tableName, int schema)
Table creation statement stringList<String>
getTableUpgradeStatements(String tableName, int level)
Statements needed to upgrade the DBstatic @NotNull RDBDocumentStoreDB
getValue(String desc)
String
makeIndexConditionalForColumn(String columnName)
String
toString()
static RDBDocumentStoreDB
valueOf(String name)
Returns the enum constant of this type with the specified name.static RDBDocumentStoreDB[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DEFAULT
public static final RDBDocumentStoreDB DEFAULT
-
H2
public static final RDBDocumentStoreDB H2
-
DERBY
public static final RDBDocumentStoreDB DERBY
-
POSTGRES
public static final RDBDocumentStoreDB POSTGRES
-
DB2
public static final RDBDocumentStoreDB DB2
-
ORACLE
public static final RDBDocumentStoreDB ORACLE
-
MYSQL
public static final RDBDocumentStoreDB MYSQL
-
MSSQL
public static final RDBDocumentStoreDB MSSQL
-
-
Field Detail
-
description
protected String description
-
vendorCode
protected RDBCommonVendorSpecificCode vendorCode
-
-
Method Detail
-
values
public static RDBDocumentStoreDB[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RDBDocumentStoreDB c : RDBDocumentStoreDB.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RDBDocumentStoreDB valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
checkVersion
public String checkVersion(DatabaseMetaData md) throws SQLException
Check the database brand and version- Throws:
SQLException
-
getFetchFirstSyntax
public RDBDocumentStoreDB.FETCHFIRSTSYNTAX getFetchFirstSyntax()
Query syntax for "FETCH FIRST"
-
getCurrentTimeStampInSecondsSyntax
public String getCurrentTimeStampInSecondsSyntax()
Query syntax for current time in ms since the epoch- Returns:
- the query syntax or empty string when no such syntax is available
-
getConcatQuery
public RDBJDBCTools.PreparedStatementComponent getConcatQuery(String appendData, int dataOctetLimit)
Returns the CONCAT function or its equivalent function or sub-query. Note that the function MUST NOT cause a truncated value to be written!- Parameters:
appendData
- string to be inserteddataOctetLimit
- expected capacity of data column
-
getInitializationStatement
@NotNull public @NotNull String getInitializationStatement()
Query for any required initialization of the DB.- Returns:
- the DB initialization SQL string
-
getTableCreationStatement
public String getTableCreationStatement(String tableName, int schema)
Table creation statement string- Parameters:
tableName
-- Returns:
- the table creation string
-
getIndexCreationStatements
public List<String> getIndexCreationStatements(String tableName, int level)
-
getAdditionalDiagnostics
@NotNull public @NotNull Map<String,String> getAdditionalDiagnostics(RDBConnectionHandler ch, String tableName)
-
getAdditionalStatistics
public Map<String,String> getAdditionalStatistics(RDBConnectionHandler ch, String catalog, String tableName)
Returns additional DB-specific statistics, augmenting the return value ofRDBDocumentStore.getStats()
.Where applicable, the following fields are returned similar to the output for MongoDB:
- storageSize
- total size of table
- size
- size of table (excl. indexes)
- totalIndexSize
- total size of all indexes
- indexSizes.indexName
- size of individual indexes
Additionally, a information obtained from the databases system tables/views can be included:
- _data
- table specific data
- indexName._data
- index specific data
These fields will just contain DB-specific name/value pairs obtained from the database. The exact fields to fetch are preconfigured by can be tuned using system properties, such as:
-Dorg.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.DB2.TABLE_STATS="card npages mpages fpages overflow pctfree avgrowsize stats_time" -Dorg.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.DB2.INDEX_STATS="indextype colnames pctfree clusterratio nleaf nlevels fullkeycard density indcard numrids numrids_deleted avgleafkeysize avgnleafkeysize remarks stats_time"
(this currently applies to DB types:
DB2
,ORACLE
, andMYSQL
).See links below for the definition of the individual fields:
POSTGRES
- PostgreSQL 9.6.6 Documentation - 9.26.7. Database Object Management FunctionsDB2
- DB2 10.5 for Linux, UNIX, and Windows: SYSCAT.TABLES catalog view, SYSCAT.INDEXES catalog viewORACLE
- Oracle Database Online Documentation 12c Release 1 (12.1): 3.118 ALL_TABLES, 2.127 ALL_INDEXESMYSQL
- MySQL 5.7 Reference Manual: 13.7.5.36 SHOW TABLE STATUS Syntax, 13.7.5.22 SHOW INDEX SyntaxMSSQL
- Developer Reference for SQL Server: sys.dm_db_partition_stats (Transact-SQL), sp_spaceused (Transact-SQL)DERBY
- Derby Reference Manual: SYSCS_DIAG.SPACE_TABLE diagnostic table function
-
getSmallintType
public String getSmallintType()
-
getBigintType
public String getBigintType()
-
getTableUpgradeStatements
public List<String> getTableUpgradeStatements(String tableName, int level)
Statements needed to upgrade the DB- Returns:
- the table modification string
-
extractFields
protected String extractFields(ResultSet rs, String indexStats) throws SQLException
- Throws:
SQLException
-
toString
public String toString()
- Overrides:
toString
in classEnum<RDBDocumentStoreDB>
-
getValue
@NotNull public static @NotNull RDBDocumentStoreDB getValue(String desc)
-
-