本文整理汇总了Java中org.pentaho.di.core.database.Database.getDDL方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getDDL方法的具体用法?Java Database.getDDL怎么用?Java Database.getDDL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.database.Database
的用法示例。
在下文中一共展示了Database.getDDL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, Repository repository) throws KettleStepException
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
// Copy the row
RowMetaInterface tableFields = new RowMeta();
// Now change the field names
for (int i=0;i<fieldTable.length;i++)
{
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
if (v!=null)
{
ValueMetaInterface tableField = v.clone();
tableField.setName(fieldTable[i]);
tableFields.addValueMeta(tableField);
}
else
{
throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
}
}
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName));
String cr_table = db.getDDL(schemaTable,
tableFields,
null,
false,
null,
true
);
String sql = cr_table;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage());
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NotReceivingAnyFields"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NoConnectionDefined"));
}
return retval;
}
示例2: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tablename))
{
Database db = new Database(databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tablename);
String cr_table = db.getDDL(schemaTable, prev);
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(Messages.getString("SQLFileOutputMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(Messages.getString("SQLFileOutputMeta.Exception.TableNotSpecified"));
}
}
else
{
retval.setError(Messages.getString("SQLFileOutputMeta.Error.NoInput"));
}
}
else
{
retval.setError(Messages.getString("SQLFileOutputMeta.Error.NoConnection"));
}
return retval;
}
示例3: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tablename))
{
Database db = new Database(databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tablename);
String cr_table = db.getDDL(schemaTable, prev);
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(Messages.getString("TableOutputMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(Messages.getString("TableOutputMeta.Error.NoTable"));
}
}
else
{
retval.setError(Messages.getString("TableOutputMeta.Error.NoInput"));
}
}
else
{
retval.setError(Messages.getString("TableOutputMeta.Error.NoConnection"));
}
return retval;
}
示例4: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tableName))
{
Database db = new Database(databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
String cr_table = db.getDDL(schemaTable,
prev,
null,
false,
null,
true
);
String cr_index = ""; //$NON-NLS-1$
String idx_fields[] = null;
if (keyLookup!=null && keyLookup.length>0)
{
idx_fields = new String[keyLookup.length];
for (int i=0;i<keyLookup.length;i++) idx_fields[i] = keyLookup[i];
}
else
{
retval.setError(Messages.getString("DeleteMeta.CheckResult.KeyFieldsRequired")); //$NON-NLS-1$
}
// Key lookup dimensions...
if (idx_fields!=null && idx_fields.length>0 &&
!db.checkIndexExists(schemaTable, idx_fields)
)
{
String indexname = "idx_"+tableName+"_lookup"; //$NON-NLS-1$ //$NON-NLS-2$
cr_index = db.getCreateIndexStatement(schemaName, tableName, indexname, idx_fields, false, false, false, true);
}
String sql = cr_table+cr_index;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(Messages.getString("DeleteMeta.Returnvalue.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("DeleteMeta.Returnvalue.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("DeleteMeta.Returnvalue.NoReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("DeleteMeta.Returnvalue.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例5: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tableName))
{
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
Database db = new Database(databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
if ( getIgnoreFlagField()!=null &&
getIgnoreFlagField().length()>0)
{
prev.addValueMeta(new ValueMeta(getIgnoreFlagField(), ValueMetaInterface.TYPE_BOOLEAN));
}
String cr_table = db.getDDL(schemaTable,
prev,
null,
false,
null,
true
);
String cr_index = ""; //$NON-NLS-1$
String idx_fields[] = null;
if (keyLookup!=null && keyLookup.length>0)
{
idx_fields = new String[keyLookup.length];
for (int i=0;i<keyLookup.length;i++) idx_fields[i] = keyLookup[i];
}
else
{
retval.setError(Messages.getString("UpdateMeta.CheckResult.MissingKeyFields")); //$NON-NLS-1$
}
// Key lookup dimensions...
if (idx_fields!=null && idx_fields.length>0 && !db.checkIndexExists(schemaName, tableName, idx_fields)
)
{
String indexname = "idx_"+tableName+"_lookup"; //$NON-NLS-1$ //$NON-NLS-2$
cr_index = db.getCreateIndexStatement(schemaName, tableName, indexname, idx_fields, false, false, false, true);
}
String sql = cr_table+cr_index;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(Messages.getString("UpdateMeta.ReturnValue.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("UpdateMeta.ReturnValue.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("UpdateMeta.ReturnValue.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(Messages.getString("UpdateMeta.ReturnValue.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例6: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
// Copy the row
RowMetaInterface tableFields = new RowMeta();
// Now change the field names
for (int i=0;i<fieldTable.length;i++)
{
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
if (v!=null)
{
ValueMetaInterface tableField = v.clone();
tableField.setName(fieldTable[i]);
tableFields.addValueMeta(tableField);
}
else
{
throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
}
}
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName));
String sql = db.getDDL(schemaTable,
tableFields,
null,
false,
null,
true
);
if (Const.isEmpty(sql)) {
retval.setSQL(null);
} else {
retval.setSQL(sql);
}
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.GetSQL.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例7: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tablename))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tablename);
String cr_table = db.getDDL(schemaTable, prev);
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(BaseMessages.getString(PKG, "SQLFileOutputMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "SQLFileOutputMeta.Exception.TableNotSpecified"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "SQLFileOutputMeta.Error.NoInput"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "SQLFileOutputMeta.Error.NoConnection"));
}
return retval;
}
示例8: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String tk, boolean use_autoinc, String pk)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tablename))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tablename);
String cr_table = db.getDDL(schemaTable, prev, tk, use_autoinc, pk);
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(BaseMessages.getString(PKG, "TableOutputMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TableOutputMeta.Error.NoTable"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TableOutputMeta.Error.NoInput"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "TableOutputMeta.Error.NoConnection"));
}
return retval;
}
示例9: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
// Copy the row
RowMetaInterface tableFields = new RowMeta();
// Now change the field names
for (int i=0;i<fieldTable.length;i++)
{
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
if (v!=null)
{
ValueMetaInterface tableField = v.clone();
tableField.setName(fieldTable[i]);
tableFields.addValueMeta(tableField);
}
else
{
throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
}
}
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName));
String sql = db.getDDL(schemaTable,
tableFields,
null,
false,
null,
true
);
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "GPBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "GPBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "GPBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "GPBulkLoaderMeta.GetSQL.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例10: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
String cr_table = db.getDDL(schemaTable,
prev,
null,
false,
null,
true
);
String cr_index = ""; //$NON-NLS-1$
String idx_fields[] = null;
if (keyLookup!=null && keyLookup.length>0)
{
idx_fields = new String[keyLookup.length];
for (int i=0;i<keyLookup.length;i++) idx_fields[i] = keyLookup[i];
}
else
{
retval.setError(BaseMessages.getString(PKG, "DeleteMeta.CheckResult.KeyFieldsRequired")); //$NON-NLS-1$
}
// Key lookup dimensions...
if (idx_fields!=null && idx_fields.length>0 &&
!db.checkIndexExists(schemaTable, idx_fields)
)
{
String indexname = "idx_"+tableName+"_lookup"; //$NON-NLS-1$ //$NON-NLS-2$
cr_index = db.getCreateIndexStatement(schemaName, tableName, indexname, idx_fields, false, false, false, true);
}
String sql = cr_table+cr_index;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例11: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tableName))
{
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
if ( getIgnoreFlagField()!=null &&
getIgnoreFlagField().length()>0)
{
prev.addValueMeta(new ValueMeta(getIgnoreFlagField(), ValueMetaInterface.TYPE_BOOLEAN));
}
String cr_table = db.getDDL(schemaTable,
prev,
null,
false,
null,
true
);
String cr_index = ""; //$NON-NLS-1$
String idx_fields[] = null;
if (keyLookup!=null && keyLookup.length>0)
{
idx_fields = new String[keyLookup.length];
for (int i=0;i<keyLookup.length;i++) idx_fields[i] = keyLookup[i];
}
else
{
retval.setError(BaseMessages.getString(PKG, "UpdateMeta.CheckResult.MissingKeyFields")); //$NON-NLS-1$
}
// Key lookup dimensions...
if (idx_fields!=null && idx_fields.length>0 && !db.checkIndexExists(schemaName, tableName, idx_fields)
)
{
String indexname = "idx_"+tableName+"_lookup"; //$NON-NLS-1$ //$NON-NLS-2$
cr_index = db.getCreateIndexStatement(schemaName, tableName, indexname, idx_fields, false, false, false, true);
}
String sql = cr_table+cr_index;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "UpdateMeta.ReturnValue.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "UpdateMeta.ReturnValue.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "UpdateMeta.ReturnValue.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "UpdateMeta.ReturnValue.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例12: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev)
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
if (!Const.isEmpty(tablename))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(null, tablename);
String cr_table = db.getDDL(schemaTable, prev);
// Squeeze in the VECTORWISE col store clause...
// TODO: move this to the database dialog and make it user configurable.
//
String VW_CLAUSE="WITH STRUCTURE=VECTORWISE";
if (cr_table.toUpperCase().contains("CREATE TABLE")) {
int scIndex = cr_table.indexOf(';');
if (scIndex<0) {
cr_table +=VW_CLAUSE;
} else {
cr_table = cr_table.substring(0, scIndex)+ VW_CLAUSE + cr_table.substring(scIndex);
}
}
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(BaseMessages.getString(PKG, "IngresVectorWiseLoaderMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "IngresVectorWiseLoaderMeta.Error.NoTable"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "IngresVectorWiseLoaderMeta.Error.NoInput"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "IngresVectorWiseLoaderMeta.Error.NoConnection"));
}
return retval;
}
示例13: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
@Override
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException {
SQLStatement retval = super.getSQLStatements(transMeta, stepMeta, prev);
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(
transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName)
);
if (!Const.isEmpty(schemaTable))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String cr_table = db.getDDL(schemaTable, prev);
// Empty string means: nothing to do: set it to null...
if (cr_table==null || cr_table.length()==0) cr_table=null;
retval.setSQL(cr_table);
}
catch(KettleDatabaseException dbe)
{
retval.setError(BaseMessages.getString(PKG, "LucidDBStreamingLoaderMeta.Error.ErrorConnecting", dbe.getMessage()));
}
finally
{
db.disconnect();
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBStreamingLoaderMeta.Error.NoTable"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBStreamingLoaderMeta.Error.NoInput"));
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "LucidDBStreamingLoaderMeta.Error.NoConnection"));
}
return retval;
}
示例14: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
// Copy the row
RowMetaInterface tableFields = new RowMeta();
// Now change the field names
for (int i=0;i<fieldTable.length;i++)
{
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
if (v!=null)
{
ValueMetaInterface tableField = v.clone();
tableField.setName(fieldTable[i]);
tableFields.addValueMeta(tableField);
}
else
{
throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
}
}
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName));
String sql = db.getDDL(schemaTable,
tableFields,
null,
false,
null,
true
);
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "OraBulkLoaderMeta.GetSQL.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}
示例15: getSQLStatements
import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException
{
SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!
if (databaseMeta!=null)
{
if (prev!=null && prev.size()>0)
{
// Copy the row
RowMetaInterface tableFields = new RowMeta();
// Now change the field names
for (int i=0;i<fieldTable.length;i++)
{
ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
if (v!=null)
{
ValueMetaInterface tableField = v.clone();
tableField.setName(fieldTable[i]);
tableFields.addValueMeta(tableField);
}
else
{
throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
}
}
if (!Const.isEmpty(tableName))
{
Database db = new Database(loggingObject, databaseMeta);
db.shareVariablesWith(transMeta);
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName),
transMeta.environmentSubstitute(tableName));
String cr_table = db.getDDL(schemaTable,
tableFields,
null,
false,
null,
true
);
String sql = cr_table;
if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
}
catch(KettleException e)
{
retval.setError(BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage()); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); //$NON-NLS-1$
}
}
else
{
retval.setError(BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.GetSQL.NoConnectionDefined")); //$NON-NLS-1$
}
return retval;
}