Skip to content

Inspection

Zsolt Herpai edited this page May 14, 2015 · 4 revisions

###Database schema inspection###

DatabaseInspection databaseInspection = query.databaseInspection();

Returns a DatabaseInspection interface that provides access to JDBC DatabaseMetaData. ####Access to JDBC DatabaseMetaData##### Callback providing full access to DatabaseMetaData, eg:

Integer dbVersion = inspection.accessMetaData(
    DatabaseMetaData::getDatabaseMajorVersion
)

####Iterating/mapping ResultSets returned by DatabaseMetaData#### A number of methods of DatabaseMetaData return ResultSets. For convenience, and avoid resource leaks FluentJdbc can iterate through these ResultSets and map the results as POJOs.

Eg:

List<String> tableNames = inspection
    .selectFromMetaData(meta -> meta.getTables(null, null, null, null))
    .listResult(rs -> rs.getString(3));

Clone this wiki locally