Enum RDBDocumentStoreDB
- java.lang.Object
-
- java.lang.Enum<RDBDocumentStoreDB>
-
- org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreDB
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<RDBDocumentStoreDB>
public enum RDBDocumentStoreDB extends java.lang.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 java.lang.String
description
protected RDBCommonVendorSpecificCode
vendorCode
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
checkVersion(java.sql.DatabaseMetaData md)
Check the database brand and versionprotected java.lang.String
extractFields(java.sql.ResultSet rs, java.lang.String indexStats)
@NotNull java.util.Map<java.lang.String,java.lang.String>
getAdditionalDiagnostics(RDBConnectionHandler ch, java.lang.String tableName)
java.util.Map<java.lang.String,java.lang.String>
getAdditionalStatistics(RDBConnectionHandler ch, java.lang.String catalog, java.lang.String tableName)
Returns additional DB-specific statistics, augmenting the return value ofRDBDocumentStore.getStats()
.java.lang.String
getBigintType()
RDBJDBCTools.PreparedStatementComponent
getConcatQuery(java.lang.String appendData, int dataOctetLimit)
Returns the CONCAT function or its equivalent function or sub-query.java.lang.String
getCurrentTimeStampInSecondsSyntax()
Query syntax for current time in ms since the epochRDBDocumentStoreDB.FETCHFIRSTSYNTAX
getFetchFirstSyntax()
Query syntax for "FETCH FIRST"java.util.List<java.lang.String>
getIndexCreationStatements(java.lang.String tableName, int level)
@NotNull java.lang.String
getInitializationStatement()
Query for any required initialization of the DB.java.lang.String
getModifiedIndexStatement(java.lang.String tableName)
java.lang.String
getSmallintType()
java.lang.String
getTableCreationStatement(java.lang.String tableName, int schema)
Table creation statement stringjava.util.List<java.lang.String>
getTableUpgradeStatements(java.lang.String tableName, int level)
Statements needed to upgrade the DBstatic @NotNull RDBDocumentStoreDB
getValue(java.lang.String desc)
java.lang.String
makeIndexConditionalForColumn(java.lang.String columnName)
java.lang.String
toString()
static RDBDocumentStoreDB
valueOf(java.lang.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 java.lang.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(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
checkVersion
public java.lang.String checkVersion(java.sql.DatabaseMetaData md) throws java.sql.SQLException
Check the database brand and version- Throws:
java.sql.SQLException
-
getFetchFirstSyntax
public RDBDocumentStoreDB.FETCHFIRSTSYNTAX getFetchFirstSyntax()
Query syntax for "FETCH FIRST"
-
getCurrentTimeStampInSecondsSyntax
public java.lang.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(java.lang.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 java.lang.String getInitializationStatement()
Query for any required initialization of the DB.- Returns:
- the DB initialization SQL string
-
getTableCreationStatement
public java.lang.String getTableCreationStatement(java.lang.String tableName, int schema)
Table creation statement string- Parameters:
tableName
-- Returns:
- the table creation string
-
getIndexCreationStatements
public java.util.List<java.lang.String> getIndexCreationStatements(java.lang.String tableName, int level)
-
getAdditionalDiagnostics
@NotNull public @NotNull java.util.Map<java.lang.String,java.lang.String> getAdditionalDiagnostics(RDBConnectionHandler ch, java.lang.String tableName)
-
getAdditionalStatistics
public java.util.Map<java.lang.String,java.lang.String> getAdditionalStatistics(RDBConnectionHandler ch, java.lang.String catalog, java.lang.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 java.lang.String getSmallintType()
-
getBigintType
public java.lang.String getBigintType()
-
makeIndexConditionalForColumn
public java.lang.String makeIndexConditionalForColumn(java.lang.String columnName)
-
getModifiedIndexStatement
public java.lang.String getModifiedIndexStatement(java.lang.String tableName)
-
getTableUpgradeStatements
public java.util.List<java.lang.String> getTableUpgradeStatements(java.lang.String tableName, int level)
Statements needed to upgrade the DB- Returns:
- the table modification string
-
extractFields
protected java.lang.String extractFields(java.sql.ResultSet rs, java.lang.String indexStats) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<RDBDocumentStoreDB>
-
getValue
@NotNull public static @NotNull RDBDocumentStoreDB getValue(java.lang.String desc)
-
-