Search in sources :

Example 1 with SQLEditor

use of org.pentaho.di.ui.core.database.dialog.SQLEditor in project pentaho-kettle by pentaho.

the class UpdateDialog method create.

// Generate code for create table...
// Conversions done by Database
private void create() {
    try {
        UpdateMeta info = new UpdateMeta();
        getInfo(info);
        // new name might not yet be linked to other steps!
        String name = stepname;
        StepMeta stepinfo = new StepMeta(BaseMessages.getString(PKG, "UpdateDialog.StepMeta.Title"), name, info);
        RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
        SQLStatement sql = info.getSQLStatements(transMeta, stepinfo, 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, "UpdateDialog.NoSQLNeeds.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "UpdateDialog.NoSQLNeeds.DialogTitle"));
                mb.open();
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(sql.getError());
            mb.setText(BaseMessages.getString(PKG, "UpdateDialog.SQLError.DialogTitle"));
            mb.open();
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "UpdateDialog.CouldNotBuildSQL.DialogTitle"), BaseMessages.getString(PKG, "UpdateDialog.CouldNotBuildSQL.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor) UpdateMeta(org.pentaho.di.trans.steps.update.UpdateMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SQLStatement(org.pentaho.di.core.SQLStatement) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 2 with SQLEditor

use of org.pentaho.di.ui.core.database.dialog.SQLEditor in project pentaho-kettle by pentaho.

the class MySQLBulkLoaderDialog method create.

// Generate code for create table...
// Conversions done by Database
private void create() {
    try {
        MySQLBulkLoaderMeta info = new MySQLBulkLoaderMeta();
        getInfo(info);
        // new name might not yet be linked to other steps!
        String name = stepname;
        StepMeta stepMeta = new StepMeta(BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.StepMeta.Title"), name, info);
        RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
        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, "MySQLBulkLoaderDialog.NoSQLNeeds.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.NoSQLNeeds.DialogTitle"));
                mb.open();
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(sql.getError());
            mb.setText(BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.SQLError.DialogTitle"));
            mb.open();
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.CouldNotBuildSQL.DialogTitle"), BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.CouldNotBuildSQL.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor) MySQLBulkLoaderMeta(org.pentaho.di.trans.steps.mysqlbulkloader.MySQLBulkLoaderMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SQLStatement(org.pentaho.di.core.SQLStatement) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 3 with SQLEditor

use of org.pentaho.di.ui.core.database.dialog.SQLEditor in project pentaho-kettle by pentaho.

the class PGBulkLoaderDialog method create.

// Generate code for create table...
// Conversions done by Database
private void create() {
    try {
        PGBulkLoaderMeta info = new PGBulkLoaderMeta();
        getInfo(info);
        // new name might not yet be linked to other steps!
        String name = stepname;
        StepMeta stepMeta = new StepMeta(BaseMessages.getString(PKG, "PGBulkLoaderDialog.StepMeta.Title"), name, info);
        RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
        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, "PGBulkLoaderDialog.NoSQLNeeds.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "PGBulkLoaderDialog.NoSQLNeeds.DialogTitle"));
                mb.open();
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(sql.getError());
            mb.setText(BaseMessages.getString(PKG, "PGBulkLoaderDialog.SQLError.DialogTitle"));
            mb.open();
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PGBulkLoaderDialog.CouldNotBuildSQL.DialogTitle"), BaseMessages.getString(PKG, "PGBulkLoaderDialog.CouldNotBuildSQL.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor) PGBulkLoaderMeta(org.pentaho.di.trans.steps.pgbulkloader.PGBulkLoaderMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SQLStatement(org.pentaho.di.core.SQLStatement) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 4 with SQLEditor

use of org.pentaho.di.ui.core.database.dialog.SQLEditor in project pentaho-kettle by pentaho.

the class SQLFileOutputDialog method sql.

// Generate code for create table...
// Conversions done by Database
// 
private void sql() {
    try {
        SQLFileOutputMeta info = new SQLFileOutputMeta();
        getInfo(info);
        RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
        StepMeta stepMeta = transMeta.findStep(stepname);
        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, "SQLFileOutputDialog.NoSQL.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "SQLFileOutputDialog.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, "SQLFileOutputDialog.BuildSQLError.DialogTitle"), BaseMessages.getString(PKG, "SQLFileOutputDialog.BuildSQLError.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) SQLFileOutputMeta(org.pentaho.di.trans.steps.sqlfileoutput.SQLFileOutputMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SQLStatement(org.pentaho.di.core.SQLStatement) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 5 with SQLEditor

use of org.pentaho.di.ui.core.database.dialog.SQLEditor in project pentaho-kettle by pentaho.

the class SpoonDBDelegate method sqlConnection.

public void sqlConnection(DatabaseMeta databaseMeta) {
    SQLEditor sql = new SQLEditor(databaseMeta, spoon.getShell(), SWT.NONE, databaseMeta, DBCache.getInstance(), "");
    sql.open();
}
Also used : SQLEditor(org.pentaho.di.ui.core.database.dialog.SQLEditor)

Aggregations

SQLEditor (org.pentaho.di.ui.core.database.dialog.SQLEditor)20 KettleException (org.pentaho.di.core.exception.KettleException)19 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)19 MessageBox (org.eclipse.swt.widgets.MessageBox)18 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)17 SQLStatement (org.pentaho.di.core.SQLStatement)16 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)15 StepMeta (org.pentaho.di.trans.step.StepMeta)15 Database (org.pentaho.di.core.database.Database)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 LogTableInterface (org.pentaho.di.core.logging.LogTableInterface)2 DuplicateParamException (org.pentaho.di.core.parameters.DuplicateParamException)2 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)2 RowMeta (org.pentaho.di.core.row.RowMeta)2 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 RepositoryPluginType (org.pentaho.di.core.plugins.RepositoryPluginType)1 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)1 Repository (org.pentaho.di.repository.Repository)1