private void sql() { try { IngresVectorwiseLoaderMeta info = new IngresVectorwiseLoaderMeta(); getInfo(info); RowMetaInterface prev = transMeta.getPrevStepFields(stepname); StepMeta stepMeta = transMeta.findStep(stepname); // Only use the fields that were specified. // RowMetaInterface prevNew = new RowMeta(); for (int i = 0; i < info.getFieldDatabase().length; i++) { ValueMetaInterface insValue = prev.searchValueMeta(info.getFieldStream()[i]); if (insValue != null) { ValueMetaInterface insertValue = insValue.clone(); insertValue.setName(info.getFieldDatabase()[i]); prevNew.addValueMeta(insertValue); } else { throw new KettleStepException( BaseMessages.getString( PKG, "IngresVectorWiseLoaderDialog.FailedToFindField.Message", info.getFieldStream()[i])); } } prev = prevNew; SQLStatement sql = info.getSQLStatements(transMeta, stepMeta, prev, repository, metaStore); if (!sql.hasError()) { if (sql.hasSQL()) { SQLEditor sqledit = new SQLEditor( transMeta, shell, SWT.NONE, info.getDatabaseMeta(), transMeta.getDbCache(), sql.getSQL()); sqledit.open(); } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION); mb.setMessage( BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.NoSQL.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.NoSQL.DialogTitle")); mb.open(); } } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage(sql.getError()); mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title")); mb.open(); } } catch (KettleException ke) { new ErrorDialog( shell, BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.BuildSQLError.DialogTitle"), BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.BuildSQLError.DialogMessage"), ke); } }
// Generate code for create table... // Conversions done by Database private void create() { try { LucidDBBulkLoaderMeta info = new LucidDBBulkLoaderMeta(); getInfo(info); String name = stepname; // new name might not yet be linked to other steps! StepMeta stepMeta = new StepMeta( BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.StepMeta.Title"), name, info); //$NON-NLS-1$ RowMetaInterface prev = transMeta.getPrevStepFields(stepname); SQLStatement sql = info.getSQLStatements(transMeta, stepMeta, prev); if (!sql.hasError()) { if (sql.hasSQL()) { SQLEditor sqledit = new SQLEditor( transMeta, shell, SWT.NONE, info.getDatabaseMeta(), transMeta.getDbCache(), sql.getSQL()); sqledit.open(); } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION); mb.setMessage( BaseMessages.getString( PKG, "LucidDBBulkLoaderDialog.NoSQLNeeds.DialogMessage")); // $NON-NLS-1$ mb.setText( BaseMessages.getString( PKG, "LucidDBBulkLoaderDialog.NoSQLNeeds.DialogTitle")); // $NON-NLS-1$ mb.open(); } } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage(sql.getError()); mb.setText( BaseMessages.getString( PKG, "LucidDBBulkLoaderDialog.SQLError.DialogTitle")); // $NON-NLS-1$ mb.open(); } } catch (KettleException ke) { new ErrorDialog( shell, BaseMessages.getString( PKG, "LucidDBBulkLoaderDialog.CouldNotBuildSQL.DialogTitle"), // $NON-NLS-1$ BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.CouldNotBuildSQL.DialogMessage"), ke); //$NON-NLS-1$ } }
protected void sql() { LoadSatMeta metaH = new LoadSatMeta(); getInfo(metaH); try { SQLStatement sql = metaH.getSQLStatements(transMeta, stepMeta, null, repository, metaStore); if (!sql.hasError()) { if (sql.hasSQL()) { SQLEditor sqledit = new SQLEditor( transMeta, shell, SWT.NONE, metaH.getDatabaseMeta(), transMeta.getDbCache(), sql.getSQL()); sqledit.open(); } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION); mb.setMessage(BaseMessages.getString(PKG, "LoadMeta.NoSQL.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "LoadMeta.NoSQL.DialogTitle")); mb.open(); } } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage(sql.getError()); mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title")); mb.open(); } } catch (KettleException ke) { new ErrorDialog( shell, BaseMessages.getString(PKG, "LoadDialog.BuildSQLError.DialogTitle"), BaseMessages.getString(PKG, "LoadDialog.BuildSQLError.DialogMessage"), ke); } }