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


Java Database.getDDL方法代码示例

本文整理汇总了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;
}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:71,代码来源:TeraDataBulkLoaderMeta.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))
			{
				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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:51,代码来源:SQLFileOutputMeta.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(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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:51,代码来源:TableOutputMeta.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))
			{
                   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

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

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

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

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

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

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

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

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

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

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

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


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