本文整理汇总了Java中org.pentaho.di.core.database.Database.checkIndexExists方法的典型用法代码示例。如果您正苦于以下问题:Java Database.checkIndexExists方法的具体用法?Java Database.checkIndexExists怎么用?Java Database.checkIndexExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.database.Database
的用法示例。
在下文中一共展示了Database.checkIndexExists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例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))
{
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;
}
示例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(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;
}
示例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))
{
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;
}