/** * The plugin ID of the database interface */ public String getPluginId() { return databaseInterface.getPluginId(); }
public DataHandler() { databaseDialects = new ArrayList<String>(); DatabaseInterface[] dialectMetas = DatabaseMeta.getDatabaseInterfaces(); for ( DatabaseInterface dialect : dialectMetas ) { databaseDialects.add( dialect.getPluginName() ); } Collections.sort( databaseDialects ); }
public boolean isMySQLVariant() { return databaseInterface.isMySQLVariant(); }
public static final int getPortForDBType( String strtype, String straccess ) { try { DatabaseInterface di = getDatabaseInterface( strtype ); di.setAccessType( getAccessType( straccess ) ); return di.getDefaultDatabasePort(); } catch ( KettleDatabaseException kde ) { return -1; } }
public DatabaseFactoryInterface getDatabaseFactory() throws Exception { PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.getPlugin( DatabasePluginType.class, databaseInterface.getPluginId() ); if ( plugin == null ) { throw new KettleDatabaseException( "database type with plugin id [" + databaseInterface.getPluginId() + "] couldn't be found!" ); } ClassLoader loader = registry.getClassLoader( plugin ); Class<?> clazz = Class.forName( databaseInterface.getDatabaseFactoryName(), true, loader ); return (DatabaseFactoryInterface) clazz.newInstance(); }
data.databaseMeta.getDatabaseInterface().useSafePoints() && getStepMeta().isDoingErrorHandling(); data.releaseSavepoint = dbInterface.releaseSavepoint(); if ( getStepMeta().isDoingErrorHandling() && !dbInterface.supportsErrorHandlingOnBatchUpdates() ) { log.logMinimal( BaseMessages.getString( PKG, "TableOutput.Warning.ErrorHandlingIsNotFullySupportedWithBatchProcessing" ) ); if ( !dbInterface.supportsStandardTableOutput() ) { throw new KettleException( dbInterface.getUnsupportedTableOutputMessage() );
@Test public void testInit_unsupportedConnection() { TableOutputMeta meta = mock( TableOutputMeta.class ); TableOutputData data = mock( TableOutputData.class ); DatabaseInterface dbInterface = mock( DatabaseInterface.class ); doNothing().when( tableOutputSpy ).logError( anyString() ); when( meta.getCommitSize() ).thenReturn( "1" ); when( meta.getDatabaseMeta() ).thenReturn( databaseMeta ); when( databaseMeta.getDatabaseInterface() ).thenReturn( dbInterface ); String unsupportedTableOutputMessage = "unsupported exception"; when( dbInterface.getUnsupportedTableOutputMessage() ).thenReturn( unsupportedTableOutputMessage ); //Will cause the Kettle Exception when( dbInterface.supportsStandardTableOutput() ).thenReturn( false ); tableOutputSpy.init( meta, data ); KettleException ke = new KettleException( unsupportedTableOutputMessage ); verify( tableOutputSpy, times( 1 ) ).logError( "An error occurred intialising this step: " + ke.getMessage() ); } }
/** * Set the name of the database. * * @param databaseName * The new name of the database */ public void setDBName( String databaseName ) { databaseInterface.setDatabaseName( databaseName ); }
|| databaseMeta.getDatabaseInterface().supportsResultSetMetadataRetrievalOnly() ) { sel_stmt = connection.createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY ); try { if ( databaseMeta.isFetchSizeSupported() && sel_stmt.getMaxRows() >= 1 ) { if ( databaseMeta.getDatabaseInterface().isMySQLVariant() ) { sel_stmt.setFetchSize( Integer.MIN_VALUE ); } else {
int[] acc = database.getAccessTypeList(); Object accessKey = accessBox.getSelectedItem(); accessBox.removeItems(); options = database.getDefaultOptions();
if ( databaseMeta.getDatabaseInterface().isMySQLVariant() ) { if ( precision >= length ) { precision = -1; valtype = ValueMetaInterface.TYPE_DATE; if ( databaseMeta.getDatabaseInterface().isMySQLVariant() ) { String property = databaseMeta.getConnectionProperties().getProperty( "yearIsDateType" ); if ( property != null && property.equalsIgnoreCase( "false" ) newV = databaseMeta.getDatabaseInterface().customizeValueFromSQLType( v, rm, index ); } catch ( SQLException e ) { throw new SQLException( e );
protected void showUnsupportedConnectionMessageBox( DatabaseInterface dbi ) { String title = BaseMessages.getString( PKG, "TableOutput.UnsupportedConnection.DialogTitle" ); String message = dbi.getUnsupportedTableOutputMessage(); String close = BaseMessages.getString( PKG, "System.Button.Close" ); MessageDialog dialog = new MessageDialog( shell, title, GUIResource.getInstance().getImageSpoon(), message, MessageDialog.WARNING, new String[] { close }, 0 ); dialog.open(); }
protected void isConnectionSupported() { final String tableName = wTable.getText(), connectionName = wConnection.getText(); if ( !Utils.isEmpty( tableName ) ) { DatabaseMeta dbmeta = transMeta.findDatabase( connectionName ); if ( dbmeta != null && !dbmeta.getDatabaseInterface().supportsStandardTableOutput() ) { showUnsupportedConnectionMessageBox( dbmeta.getDatabaseInterface() ); } } }
@Override public Map<String, String> getDefaultOptions() { if ( databaseDialect != null ) { return databaseDialect.getDefaultOptions(); } return super.getDefaultOptions(); }
/** * @return The extra attributes for this database connection */ public Properties getAttributes() { return databaseInterface.getAttributes(); }
public int getDefaultDatabasePort() { return databaseInterface.getDefaultDatabasePort(); }
public static final int[] getAccessTypeList( String dbTypeDesc ) { try { DatabaseInterface di = findDatabaseInterface( dbTypeDesc ); return di.getAccessTypeList(); } catch ( KettleDatabaseException kde ) { return null; } }
protected DatabaseMeta createDatabase( String name ) { DatabaseMeta db = new DatabaseMeta(); db.setName( name ); db.getDatabaseInterface().setDatabaseName( name ); return db; }
public void applyDefaultOptions( DatabaseInterface databaseInterface ) { final Map<String, String> extraOptions = getExtraOptions(); final Map<String, String> defaultOptions = databaseInterface.getDefaultOptions(); for ( String option : defaultOptions.keySet() ) { String value = defaultOptions.get( option ); String[] split = option.split( "[.]", 2 ); if ( !extraOptions.containsKey( option ) && split.length == 2 ) { addExtraOption( split[0], split[1], value ); } } }
databaseInterface.getAttributes(), level + 1, stringList, parentObject, grandParentObject, field ); findMetaData( obj, level + 1, stringList, parentObject, grandParentObject ); } else if ( obj instanceof Map ) {