当前位置: 首页>>代码示例>>Java>>正文


Java Database.getCreateIndexStatement方法代码示例

本文整理汇总了Java中org.pentaho.di.core.database.Database.getCreateIndexStatement方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getCreateIndexStatement方法的具体用法?Java Database.getCreateIndexStatement怎么用?Java Database.getCreateIndexStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.database.Database的用法示例。


在下文中一共展示了Database.getCreateIndexStatement方法的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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:73,代码来源:DeleteMeta.java

示例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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:79,代码来源:UpdateMeta.java

示例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;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:73,代码来源:DeleteMeta.java

示例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;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:79,代码来源:UpdateMeta.java


注:本文中的org.pentaho.di.core.database.Database.getCreateIndexStatement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。