Java Code Examples for java.sql.DatabaseMetaData#supportsGetGeneratedKeys()

The following examples show how to use java.sql.DatabaseMetaData#supportsGetGeneratedKeys() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtractedDatabaseMetaDataImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public Builder apply(DatabaseMetaData databaseMetaData) throws SQLException {
	connectionCatalogName = databaseMetaData.getConnection().getCatalog();
	// NOTE : databaseMetaData.getConnection().getSchema() would require java 1.7 as baseline
	supportsRefCursors = StandardRefCursorSupport.supportsRefCursors( databaseMetaData );
	supportsNamedParameters = databaseMetaData.supportsNamedParameters();
	supportsScrollableResults = databaseMetaData.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
	supportsGetGeneratedKeys = databaseMetaData.supportsGetGeneratedKeys();
	supportsBatchUpdates = databaseMetaData.supportsBatchUpdates();
	supportsDataDefinitionInTransaction = !databaseMetaData.dataDefinitionIgnoredInTransactions();
	doesDataDefinitionCauseTransactionCommit = databaseMetaData.dataDefinitionCausesTransactionCommit();
	extraKeywords = parseKeywords( databaseMetaData.getSQLKeywords() );
	sqlStateType = SQLStateType.interpretReportedSQLStateType( databaseMetaData.getSQLStateType() );
	lobLocatorUpdateCopy = databaseMetaData.locatorsUpdateCopy();
	typeInfoSet = new LinkedHashSet<TypeInfo>();
	typeInfoSet.addAll( TypeInfo.extractTypeInfo( databaseMetaData ) );
	return this;
}
 
Example 2
Source File: DerbyTableMetaDataProvider.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
	super.initializeWithMetaData(databaseMetaData);
	if (!databaseMetaData.supportsGetGeneratedKeys()) {
		if (logger.isInfoEnabled()) {
			logger.info("Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as " +
					"'false' by " + databaseMetaData.getDriverName() + " " + databaseMetaData.getDriverVersion());
		}
		this.supportsGeneratedKeysOverride = true;
	}
}
 
Example 3
Source File: DerbyTableMetaDataProvider.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
	super.initializeWithMetaData(databaseMetaData);
	if (!databaseMetaData.supportsGetGeneratedKeys()) {
		if (logger.isInfoEnabled()) {
			logger.info("Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as " +
					"'false' by " + databaseMetaData.getDriverName() + " " + databaseMetaData.getDriverVersion());
		}
		this.supportsGeneratedKeysOverride = true;
	}
}
 
Example 4
Source File: DerbyTableMetaDataProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
	super.initializeWithMetaData(databaseMetaData);
	if (!databaseMetaData.supportsGetGeneratedKeys()) {
		if (logger.isWarnEnabled()) {
			logger.warn("Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as " +
					"'false' by " + databaseMetaData.getDriverName() + " " + databaseMetaData.getDriverVersion());
		}
		this.supportsGeneratedKeysOverride = true;
	}
}
 
Example 5
Source File: DerbyTableMetaDataProvider.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
	super.initializeWithMetaData(databaseMetaData);
	if (!databaseMetaData.supportsGetGeneratedKeys()) {
		logger.warn("Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as " +
				"'false' by " + databaseMetaData.getDriverName() + " " + databaseMetaData.getDriverVersion());
		supportsGeneratedKeysOverride = true;
	}
}
 
Example 6
Source File: AbstractJdbcSpecific.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public boolean supportsGetGeneratedKeys(DatabaseMetaData metadata) throws SQLException {
	try {
		boolean result = metadata.supportsGetGeneratedKeys();
		return result;
	}
	catch (Exception e) {
		if (e instanceof SQLException) throw (SQLException)e;  
		return false;
	}
}
 
Example 7
Source File: DerbyTableMetaDataProvider.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
	super.initializeWithMetaData(databaseMetaData);
	if (!databaseMetaData.supportsGetGeneratedKeys()) {
		logger.warn("Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as " +
				"'false' by " + databaseMetaData.getDriverName() + " " + databaseMetaData.getDriverVersion());
		supportsGeneratedKeysOverride = true;
	}
}