@Test public void testVariableSubstitution() throws KettleException { lder.init( lmeta, ldata ); String is = null; is = new String( ldata.quote ); Assert.assertEquals( "'", is ); is = new String( ldata.separator ); Assert.assertEquals( ",", is ); Assert.assertEquals( "UTF8", ldata.bulkTimestampMeta.getStringEncoding() ); Assert.assertEquals( "UTF8", ldata.bulkDateMeta.getStringEncoding() ); Assert.assertEquals( "UTF8", ldata.bulkNumberMeta.getStringEncoding() ); Assert.assertEquals( "`someschema`.`sometable`", ldata.schemaTable ); }
@Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else { data.quote = environmentSubstitute( meta.getEnclosure() ).getBytes(); } if ( Utils.isEmpty( meta.getDelimiter() ) ) { data.separator = "\t".getBytes(); } else { data.separator = environmentSubstitute( meta.getDelimiter() ).getBytes(); } data.newline = Const.CR.getBytes(); String realEncoding = environmentSubstitute( meta.getEncoding() ); data.bulkTimestampMeta = new ValueMetaDate( "timestampMeta" ); data.bulkTimestampMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); data.bulkTimestampMeta.setStringEncoding( realEncoding ); data.bulkDateMeta = new ValueMetaDate( "dateMeta" ); data.bulkDateMeta.setConversionMask( "yyyy-MM-dd" ); data.bulkDateMeta.setStringEncoding( realEncoding ); data.bulkNumberMeta = new ValueMetaNumber( "numberMeta" ); data.bulkNumberMeta.setConversionMask( "#.#" ); data.bulkNumberMeta.setGroupingSymbol( "," ); data.bulkNumberMeta.setDecimalSymbol( "." ); data.bulkNumberMeta.setStringEncoding( realEncoding ); data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTableName() ) ); return true; } return false; }
MySQLBulkLoader extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else { data.quote = environmentSubstitute( meta.getEnclosure() ).getBytes(); } if ( Utils.isEmpty( meta.getDelimiter() ) ) { data.separator = "\t".getBytes(); } else { data.separator = environmentSubstitute( meta.getDelimiter() ).getBytes(); } data.newline = Const.CR.getBytes(); String realEncoding = environmentSubstitute( meta.getEncoding() ); data.bulkTimestampMeta = new ValueMetaDate( "timestampMeta" ); data.bulkTimestampMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); data.bulkTimestampMeta.setStringEncoding( realEncoding ); data.bulkDateMeta = new ValueMetaDate( "dateMeta" ); data.bulkDateMeta.setConversionMask( "yyyy-MM-dd" ); data.bulkDateMeta.setStringEncoding( realEncoding ); data.bulkNumberMeta = new ValueMetaNumber( "numberMeta" ); data.bulkNumberMeta.setConversionMask( "#.#" ); data.bulkNumberMeta.setGroupingSymbol( "," ); data.bulkNumberMeta.setDecimalSymbol( "." ); data.bulkNumberMeta.setStringEncoding( realEncoding ); data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTableName() ) ); return true; } return false; } }
MySQLBulkLoader extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else { data.quote = environmentSubstitute( meta.getEnclosure() ).getBytes(); } if ( Utils.isEmpty( meta.getDelimiter() ) ) { data.separator = "\t".getBytes(); } else { data.separator = environmentSubstitute( meta.getDelimiter() ).getBytes(); } data.newline = Const.CR.getBytes(); String realEncoding = environmentSubstitute( meta.getEncoding() ); data.bulkTimestampMeta = new ValueMetaDate( "timestampMeta" ); data.bulkTimestampMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); data.bulkTimestampMeta.setStringEncoding( realEncoding ); data.bulkDateMeta = new ValueMetaDate( "dateMeta" ); data.bulkDateMeta.setConversionMask( "yyyy-MM-dd" ); data.bulkDateMeta.setStringEncoding( realEncoding ); data.bulkNumberMeta = new ValueMetaNumber( "numberMeta" ); data.bulkNumberMeta.setConversionMask( "#.#" ); data.bulkNumberMeta.setGroupingSymbol( "," ); data.bulkNumberMeta.setDecimalSymbol( "." ); data.bulkNumberMeta.setStringEncoding( realEncoding ); data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTableName() ) ); return true; } return false; } MySQLBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); }
MySQLBulkLoader extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else { data.quote = environmentSubstitute( meta.getEnclosure() ).getBytes(); } if ( Utils.isEmpty( meta.getDelimiter() ) ) { data.separator = "\t".getBytes(); } else { data.separator = environmentSubstitute( meta.getDelimiter() ).getBytes(); } data.newline = Const.CR.getBytes(); String realEncoding = environmentSubstitute( meta.getEncoding() ); data.bulkTimestampMeta = new ValueMetaDate( "timestampMeta" ); data.bulkTimestampMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); data.bulkTimestampMeta.setStringEncoding( realEncoding ); data.bulkDateMeta = new ValueMetaDate( "dateMeta" ); data.bulkDateMeta.setConversionMask( "yyyy-MM-dd" ); data.bulkDateMeta.setStringEncoding( realEncoding ); data.bulkNumberMeta = new ValueMetaNumber( "numberMeta" ); data.bulkNumberMeta.setConversionMask( "#.#" ); data.bulkNumberMeta.setGroupingSymbol( "," ); data.bulkNumberMeta.setDecimalSymbol( "." ); data.bulkNumberMeta.setStringEncoding( realEncoding ); data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTableName() ) ); return true; } return false; } MySQLBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean execute( MySQLBulkLoaderMeta meta ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
MySQLBulkLoader extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else { data.quote = environmentSubstitute( meta.getEnclosure() ).getBytes(); } if ( Utils.isEmpty( meta.getDelimiter() ) ) { data.separator = "\t".getBytes(); } else { data.separator = environmentSubstitute( meta.getDelimiter() ).getBytes(); } data.newline = Const.CR.getBytes(); String realEncoding = environmentSubstitute( meta.getEncoding() ); data.bulkTimestampMeta = new ValueMetaDate( "timestampMeta" ); data.bulkTimestampMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); data.bulkTimestampMeta.setStringEncoding( realEncoding ); data.bulkDateMeta = new ValueMetaDate( "dateMeta" ); data.bulkDateMeta.setConversionMask( "yyyy-MM-dd" ); data.bulkDateMeta.setStringEncoding( realEncoding ); data.bulkNumberMeta = new ValueMetaNumber( "numberMeta" ); data.bulkNumberMeta.setConversionMask( "#.#" ); data.bulkNumberMeta.setGroupingSymbol( "," ); data.bulkNumberMeta.setDecimalSymbol( "." ); data.bulkNumberMeta.setStringEncoding( realEncoding ); data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTableName() ) ); return true; } return false; } MySQLBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean execute( MySQLBulkLoaderMeta meta ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi );  }