java.lang.Object
org.litebridge.db.spi.impl.engine.DefaultMetaDataEngine
- All Implemented Interfaces:
MetaDataEngine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DatabaseMetaDatacreateDatabaseMetaData(ConnectionProvider connectionProvider) databaseMetaData(ConnectionProvider connectionProvider) Retrieve metadata for the connected database.ensureTableMetaData(Table table, ConnectionProvider connectionProvider) Ensure that table metadata is available for the specified table, fetching it if not already cached.protected TableMetaDatafetchTableMetaData(Table table, ConnectionProvider connectionProvider) Retrieve metadata for the specified table, including its primary keys and expressions.protected List<ColumnMetaData> getColumnMetaData(Table table, DatabaseMetaData databaseMetaData) Retrieve column metadata for the specified table.getPrimaryKeyColumnNames(Table table, DatabaseMetaData databaseMetaData) Retrieve the names of the primary key columns for the specified table.metaData()Retrieve metadata/capabilities of this database provider.protected static voidverifySchemaAndTableExists(Table table, DatabaseMetaData databaseMetaData) Verify that the specified schema and table exist in the database.
-
Constructor Details
-
DefaultMetaDataEngine
-
-
Method Details
-
metaData
Description copied from interface:MetaDataEngineRetrieve metadata/capabilities of this database provider.- Specified by:
metaDatain interfaceMetaDataEngine- Returns:
- metadata for this database provider.
-
databaseMetaData
Description copied from interface:MetaDataEngineRetrieve metadata for the connected database.- Specified by:
databaseMetaDatain interfaceMetaDataEngine- Parameters:
connectionProvider- theConnectionProviderused to get a database connection.- Returns:
- a
DatabaseMetaDataobject containing information about the connected database.
-
ensureTableMetaData
Description copied from interface:MetaDataEngineEnsure that table metadata is available for the specified table, fetching it if not already cached.- Specified by:
ensureTableMetaDatain interfaceMetaDataEngine- Parameters:
table- theTableobject representing the tableconnectionProvider- theConnectionProviderused to fetch metadata if needed- Returns:
- the
TableMetaDatafor the table
-
fetchTableMetaData
protected TableMetaData fetchTableMetaData(Table table, ConnectionProvider connectionProvider) throws SQLException Retrieve metadata for the specified table, including its primary keys and expressions.This executes a database query to fetch database metadata.
- Parameters:
table- the table for which metadata is being fetched, containing schema, catalog, and table name detailsconnectionProvider- theConnectionProviderused to obtain a database connection.- Returns:
- a
TableMetaDataobject containing details about the table's structure, primary keys, and column metadata - Throws:
SQLException- if an error occurs while fetching database metadata
-
verifySchemaAndTableExists
protected static void verifySchemaAndTableExists(Table table, DatabaseMetaData databaseMetaData) throws SQLException Verify that the specified schema and table exist in the database.- Parameters:
table- theTableobject representing the table to verifydatabaseMetaData- theDatabaseMetaDataobject used to perform the verification- Throws:
SQLException- if an error occurs while performing the verificationIllegalArgumentException- if the schema or table is not found
-
getColumnMetaData
protected List<ColumnMetaData> getColumnMetaData(Table table, DatabaseMetaData databaseMetaData) throws SQLException Retrieve column metadata for the specified table.- Parameters:
table- theTableobject representing the tabledatabaseMetaData- theDatabaseMetaDataobject used to retrieve column information- Returns:
- a list of
ColumnMetaDataobjects representing the table's columns - Throws:
SQLException- if an error occurs while retrieving column metadata
-
getPrimaryKeyColumnNames
protected List<String> getPrimaryKeyColumnNames(Table table, DatabaseMetaData databaseMetaData) throws SQLException Retrieve the names of the primary key columns for the specified table.- Parameters:
table- theTableobject representing the tabledatabaseMetaData- theDatabaseMetaDataobject used to retrieve primary key information- Returns:
- a list of primary key column names
- Throws:
SQLException- if an error occurs while retrieving primary key information
-
createDatabaseMetaData
-