Skip to content

Instantly share code, notes, and snippets.

@sebersole
Last active June 16, 2017 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebersole/5af5bc5456701054632dd0eb65403505 to your computer and use it in GitHub Desktop.
Save sebersole/5af5bc5456701054632dd0eb65403505 to your computer and use it in GitHub Desktop.
6.0 Dialect proposal - DatabaseInformation
package org.hibernate.boot.jdbc.spi;
import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
public interface DatabaseInformation extends ExtractedDatabaseMetaData, DialectResolutionInfo {
}
package org.hibernate.engine.jdbc.dialect.spi;
public interface DialectResolutionInfo {
// this is the existing contract. added here for ease of judging proposal
/**
* Constant used to indicate that no version is defined
*/
public static final int NO_VERSION = -9999;
/**
* Obtain access to the database name, as returned from {@link java.sql.DatabaseMetaData#getDatabaseProductName()}
* for the target database
*
* @return The database name
*
* @see java.sql.DatabaseMetaData#getDatabaseProductName()
*/
public String getDatabaseName();
/**
* Obtain access to the database major version, as returned from
* {@link java.sql.DatabaseMetaData#getDatabaseMajorVersion()} for the target database.
*
* @return The database major version, or {@value #NO_VERSION} to indicate "no version information"
*
* @see java.sql.DatabaseMetaData#getDatabaseMajorVersion()
*/
public int getDatabaseMajorVersion();
/**
* Obtain access to the database minor version, as returned from
* {@link java.sql.DatabaseMetaData#getDatabaseMinorVersion()} for the target database.
*
* @return The database minor version, or {@value #NO_VERSION} to indicate "no version information"
*
* @see java.sql.DatabaseMetaData#getDatabaseMinorVersion()
*/
public int getDatabaseMinorVersion();
/**
* Obtain access to the name of the JDBC driver, as returned from {@link java.sql.DatabaseMetaData#getDriverName()}
* for the target database
*
* @return The JDBC driver name
*
* @see java.sql.DatabaseMetaData#getDriverName()
*/
public String getDriverName();
/**
* Obtain access to the major version of the JDBC driver, as returned from
* {@link java.sql.DatabaseMetaData#getDriverMajorVersion()} ()} for the target database.
*
* @return The JDBC driver major version, or {@value #NO_VERSION} to indicate "no version information"
*
* @see java.sql.DatabaseMetaData#getDriverMajorVersion()
*/
public int getDriverMajorVersion();
/**
* Obtain access to the minor version of the JDBC driver, as returned from
* {@link java.sql.DatabaseMetaData#getDriverMinorVersion()} for the target database.
*
* @return The JDBC driver minor version, or {@value #NO_VERSION} to indicate "no version information"
*
* @see java.sql.DatabaseMetaData#getDriverMinorVersion()
*/
public int getDriverMinorVersion();
}
package org.hibernate.engine.jdbc.env.spi;
import java.util.LinkedHashSet;
import java.util.Set;
import org.hibernate.engine.jdbc.spi.TypeInfo;
public interface ExtractedDatabaseMetaData {
// this is the existing contract. added here for ease of judging proposal
/**
* Retrieve the name of the catalog in effect when we connected to the database.
*
* @return The catalog name
*/
String getConnectionCatalogName();
/**
* Retrieve the name of the schema in effect when we connected to the database.
*
* @return The schema name
*/
String getConnectionSchemaName();
/**
* Set of type info reported by the driver.
*
* @return The type information obtained from the driver.
*
* @see java.sql.DatabaseMetaData#getTypeInfo()
*/
LinkedHashSet<TypeInfo> getTypeInfoSet();
/**
* Get the list of extra keywords (beyond standard SQL92 keywords) reported by the driver.
*
* @return The extra keywords used by this database.
*
* @see java.sql.DatabaseMetaData#getSQLKeywords()
*/
Set<String> getExtraKeywords();
/**
* Does the driver report supporting named parameters?
*
* @return {@code true} indicates the driver reported true; {@code false} indicates the driver reported false
* or that the driver could not be asked.
*/
boolean supportsNamedParameters();
/**
* Does the driver report supporting REF_CURSORs?
*
* @return {@code true} indicates the driver reported true; {@code false} indicates the driver reported false
* or that the driver could not be asked.
*/
boolean supportsRefCursors();
/**
* Did the driver report to supporting scrollable result sets?
*
* @return True if the driver reported to support {@link java.sql.ResultSet#TYPE_SCROLL_INSENSITIVE}.
*
* @see java.sql.DatabaseMetaData#supportsResultSetType
*/
boolean supportsScrollableResults();
/**
* Did the driver report to supporting retrieval of generated keys?
*
* @return True if the if the driver reported to support calls to {@link java.sql.Statement#getGeneratedKeys}
*
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys
*/
boolean supportsGetGeneratedKeys();
/**
* Did the driver report to supporting batched updates?
*
* @return True if the driver supports batched updates
*
* @see java.sql.DatabaseMetaData#supportsBatchUpdates
*/
boolean supportsBatchUpdates();
/**
* Did the driver report to support performing DDL within transactions?
*
* @return True if the drivers supports DDL statements within transactions.
*
* @see java.sql.DatabaseMetaData#dataDefinitionIgnoredInTransactions
*/
boolean supportsDataDefinitionInTransaction();
/**
* Did the driver report to DDL statements performed within a transaction performing an implicit commit of the
* transaction.
*
* @return True if the driver/database performs an implicit commit of transaction when DDL statement is
* performed
*
* @see java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()
*/
boolean doesDataDefinitionCauseTransactionCommit();
/**
* Retrieve the type of codes the driver says it uses for {@code SQLState}. They might follow either
* the X/Open standard or the SQL92 standard.
*
* @return The SQLState strategy reportedly used by this driver/database.
*
* @see java.sql.DatabaseMetaData#getSQLStateType()
*/
SQLStateType getSqlStateType();
/**
* Did the driver report that updates to a LOB locator affect a copy of the LOB?
*
* @return True if updates to the state of a LOB locator update only a copy.
*
* @see java.sql.DatabaseMetaData#locatorsUpdateCopy()
*/
boolean doesLobLocatorUpdateCopy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment