public DataHandler() { databaseDialects = new ArrayList<String>(); DatabaseInterface[] dialectMetas = DatabaseMeta.getDatabaseInterfaces(); for ( DatabaseInterface dialect : dialectMetas ) { databaseDialects.add( dialect.getPluginName() ); } Collections.sort( databaseDialects ); }
private void resolveDialect( String dialectName ) { if ( dialectName == null ) { return; } if ( dialectName.equals( getPluginName() ) ) { databaseDialect = null; } else { DatabaseInterface[] dialects = DatabaseMeta.getDatabaseInterfaces(); for ( DatabaseInterface dialect : dialects ) { if ( dialectName.equals( dialect.getPluginName() ) ) { databaseDialect = dialect; break; } } } }
/** * Return SQL TRUNCATE statement for a Table * * @param schema The schema * @param tableNameWithSchema The table to create * @throws KettleDatabaseException */ public String getDDLTruncateTable( String schema, String tablename ) throws KettleDatabaseException { if ( Utils.isEmpty( connectionGroup ) ) { String truncateStatement = databaseMeta.getTruncateTableStatement( schema, tablename ); if ( truncateStatement == null ) { throw new KettleDatabaseException( "Truncate table not supported by " + databaseMeta.getDatabaseInterface().getPluginName() ); } return truncateStatement; } else { return ( "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, tablename ) ); } }
public void truncateTable( String schema, String tablename ) throws KettleDatabaseException { if ( Utils.isEmpty( connectionGroup ) ) { String truncateStatement = databaseMeta.getTruncateTableStatement( schema, tablename ); if ( truncateStatement == null ) { throw new KettleDatabaseException( "Truncate table not supported by " + databaseMeta.getDatabaseInterface().getPluginName() ); } execStatement( truncateStatement ); } else { execStatement( "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, tablename ) ); } }
public void truncateTable( String tablename ) throws KettleDatabaseException { if ( Utils.isEmpty( connectionGroup ) ) { String truncateStatement = databaseMeta.getTruncateTableStatement( null, tablename ); if ( truncateStatement == null ) { throw new KettleDatabaseException( "Truncate table not supported by " + databaseMeta.getDatabaseInterface().getPluginName() ); } execStatement( truncateStatement ); } else { execStatement( "DELETE FROM " + databaseMeta.quoteField( tablename ) ); } }
public void truncate() { if ( this.model.getTable() == null ) { return; } DatabaseMeta dm = this.model.getDatabaseMeta(); String message = dm.getTruncateTableStatement( this.model.getSchema(), this.model.getTable() ); if ( message == null ) { message = "Truncating tables is not supported by " + dm.getDatabaseInterface().getPluginName(); } SQLEditor theSqlEditor = new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, dm, this.dbcache, "-- " + message ); theSqlEditor.open(); }