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


Java Database.getTableFields方法代码示例

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


在下文中一共展示了Database.getTableFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTableFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getTableFields()
{
	RowMetaInterface fields = null;
	if (databaseMeta != null)
	{
		Database db = new Database(loggingObject, databaseMeta);
		try
		{
			db.connect();
			fields = db.getTableFields(databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName));
		}
		catch (KettleDatabaseException dbe)
		{
			logError(BaseMessages.getString(PKG, "DimensionLookupMeta.Log.DatabaseErrorOccurred") + dbe.getMessage()); //$NON-NLS-1$
		}
		finally
		{
			db.disconnect();
		}
	}
	return fields;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:DimensionLookupMeta.java

示例2: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.pentaho.di.trans.step.BaseStepMeta#getRequiredFields(org.pentaho.di.core.variables.VariableSpace)
 */
@Override
public RowMetaInterface getRequiredFields(final VariableSpace space) throws KettleException {
    if (!this.useControlFile.getValue()) {
        final Database database = connectToDatabase();
        database.shareVariablesWith(space);

        final String schemaTable = getQuotedSchemaTableName(space);
        RowMetaInterface fields = database.getTableFields(schemaTable);
        database.disconnect();
        if (fields == null) {
            throw new KettleException(MESSAGES.getString("TeraFastMeta.Exception.TableNotFound"));
        }
        return fields;
    }
    return null;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:TeraFastMeta.java

示例3: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Gets a list of fields in the database table
 * @param space The variable space
 * @return The metadata about the fields in the table.
 * @throws KettleException
 */
public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {
  String realTableName = space.environmentSubstitute( targetTable );
  String realSchemaName = space.environmentSubstitute( targetSchema );

  if ( databaseMeta != null ) {
    Database db = new Database( loggingObject, databaseMeta );
    try {
      db.connect();

      if ( !Const.isEmpty( realTableName ) ) {
        String schemaTable = databaseMeta.getQuotedSchemaTableCombination( realSchemaName, realTableName );

        // Check if this table exists...
        if ( db.checkTableExists( schemaTable ) ) {
          return db.getTableFields( schemaTable );
        } else {
          throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.TableNotFound" ) );
        }
      } else {
        throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.TableNotSpecified" ) );
      }
    } catch ( Exception e ) {
      throw new KettleException(
        BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.ErrorGettingFields" ), e );
    } finally {
      db.disconnect();
    }
  } else {
    throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.ConnectionNotDefined" ) );
  }

}
 
开发者ID:inquidia,项目名称:PentahoSnowflakePlugin,代码行数:39,代码来源:SnowflakeBulkLoaderMeta.java

示例4: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException {
	String realTableName = space.environmentSubstitute(tableName);
	String realSchemaName = space.environmentSubstitute(schemaName);

	if (databaseMeta != null) {
		Database db = new Database(loggingObject, databaseMeta);
		try {
			db.connect();

			if (!Const.isEmpty(realTableName)) {
				String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);
				// Check if this table exists...
				if (db.checkTableExists(schemaTable)) {
					RowMetaInterface rv = db.getTableFields(schemaTable);
					return rv;
				} else {
					throw new KettleException(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.Exception.TableNotFound"));
				}
			} else {
				throw new KettleException(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.Exception.TableNotSpecified"));
			}
		} catch (Exception e) {
			throw new KettleException(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.Exception.ErrorGettingFields"), e);
		} finally {
			db.disconnect();
		}
	} else {
		throw new KettleException(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.Exception.ConnectionNotDefined"));
	}

}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:32,代码来源:TeraDataBulkLoaderMeta.java

示例5: getTableFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
private RowMetaInterface getTableFields() throws KettleDatabaseException {
	Database database = new Database(databaseMeta);
	try {
		database.connect();
		return database.getTableFields(schemaTable);
	}
	finally {
		database.disconnect();
	}
	 
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:12,代码来源:TransProfileFactory.java

示例6: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException {
	String realTableName = space.environmentSubstitute(tablename);
	String realSchemaName = space.environmentSubstitute(schemaName);

	if (databaseMeta != null) {
		Database db = new Database(databaseMeta);
		try {
			db.connect();

			if (!Const.isEmpty(realTableName)) {
				String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

				// Check if this table exists...
				if (db.checkTableExists(schemaTable)) {
					return db.getTableFields(schemaTable);
				} else {
					throw new KettleException(Messages.getString("SQLFileOutputMeta.Exception.TableNotFound"));
				}
			} else {
				throw new KettleException(Messages.getString("SQLFileOutputMeta.Exception.TableNotSpecified"));
			}
		} catch (Exception e) {
			throw new KettleException(Messages.getString("SQLFileOutputMeta.Exception.ErrorGettingFields"), e);
		} finally {
			db.disconnect();
		}
	} else {
		throw new KettleException(Messages.getString("SQLFileOutputMeta.Exception.ConnectionNotDefined"));
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:SQLFileOutputMeta.java

示例7: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space)
    throws KettleException {
  String realTableName = space.environmentSubstitute(tableName);
  String realSchemaName = space.environmentSubstitute(schemaName);

  if (databaseMeta != null) {
    Database db = new Database(loggingObject, databaseMeta);
    try {
      db.connect();

      if (!Const.isEmpty(realTableName)) {
        String schemaTable = databaseMeta.getQuotedSchemaTableCombination(
            realSchemaName, realTableName);

        // Check if this table exists...
        if (db.checkTableExists(schemaTable)) {
          return db.getTableFields(schemaTable);
        } else {
          throw new KettleException(BaseMessages.getString(PKG,
              "LucidDBStreamingLoaderMeta.Exception.TableNotFound"));
        }
      } else {
        throw new KettleException(BaseMessages.getString(PKG,
            "LucidDBStreamingLoaderMeta.Exception.TableNotSpecified"));
      }
    } catch (Exception e) {
      throw new KettleException(BaseMessages.getString(PKG,
          "LucidDBStreamingLoaderMeta.Exception.ErrorGettingFields"), e);
    } finally {
      db.disconnect();
    }
  } else {
    throw new KettleException(BaseMessages.getString(PKG,
        "LucidDBStreamingLoaderMeta.Exception.ConnectionNotDefined"));
  }

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:LucidDBStreamingLoaderMeta.java

示例8: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
{
	String realTableName = space.environmentSubstitute(tableName);
	String realSchemaName = space.environmentSubstitute(schemaName);

    if (databaseMeta!=null)
    {
        Database db = new Database(databaseMeta);
        try
        {
            db.connect();

            if (!Const.isEmpty(realTableName))
            {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                // Check if this table exists...
                if (db.checkTableExists(schemaTable))
                {
                    return db.getTableFields(schemaTable);
                }
                else
                {
                    throw new KettleException(Messages.getString("LucidDBBulkLoaderMeta.Exception.TableNotFound"));
                }
            }
            else
            {
                throw new KettleException(Messages.getString("LucidDBBulkLoaderMeta.Exception.TableNotSpecified"));
            }
        }
        catch(Exception e)
        {
            throw new KettleException(Messages.getString("LucidDBBulkLoaderMeta.Exception.ErrorGettingFields"), e);
        }
        finally
        {
            db.disconnect();
        }
    }
    else
    {
        throw new KettleException(Messages.getString("LucidDBBulkLoaderMeta.Exception.ConnectionNotDefined"));
    }

}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:47,代码来源:LucidDBBulkLoaderMeta.java

示例9: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
{
	String realSchemaName = space.environmentSubstitute(schemaName);
	String realTableName = space.environmentSubstitute(tableName);
	
    if (databaseMeta!=null)
    {
        Database db = new Database(loggingObject, databaseMeta);
        try
        {
            db.connect();
            
            if (!Const.isEmpty(realTableName))
            {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                // Check if this table exists...
                if (db.checkTableExists(schemaTable))
                {
                    return db.getTableFields(schemaTable);
                }
                else
                {
                    throw new KettleException(BaseMessages.getString(PKG, "InsertUpdateMeta.Exception.TableNotFound"));
                }
            }
            else
            {
                throw new KettleException(BaseMessages.getString(PKG, "InsertUpdateMeta.Exception.TableNotSpecified"));
            }
        }
        catch(Exception e)
        {
            throw new KettleException(BaseMessages.getString(PKG, "InsertUpdateMeta.Exception.ErrorGettingFields"), e);
        }
        finally
        {
            db.disconnect();
        }
    }
    else
    {
        throw new KettleException(BaseMessages.getString(PKG, "InsertUpdateMeta.Exception.ConnectionNotDefined"));
    }

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:InsertUpdateMeta.java

示例10: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
{
	String realSchemaName = space.environmentSubstitute(schemaName);
	String realTableName = space.environmentSubstitute(tableName);
	
    if (databaseMeta!=null)
    {
        Database db = new Database(databaseMeta);
        try
        {
            db.connect();
            
            if (!Const.isEmpty(realTableName))
            {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                // Check if this table exists...
                if (db.checkTableExists(schemaTable))
                {
                    return db.getTableFields(schemaTable);
                }
                else
                {
                    throw new KettleException(Messages.getString("InsertUpdateMeta.Exception.TableNotFound"));
                }
            }
            else
            {
                throw new KettleException(Messages.getString("InsertUpdateMeta.Exception.TableNotSpecified"));
            }
        }
        catch(Exception e)
        {
            throw new KettleException(Messages.getString("InsertUpdateMeta.Exception.ErrorGettingFields"), e);
        }
        finally
        {
            db.disconnect();
        }
    }
    else
    {
        throw new KettleException(Messages.getString("InsertUpdateMeta.Exception.ConnectionNotDefined"));
    }

}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:47,代码来源:InsertUpdateMeta.java

示例11: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
{
	String realTableName = space.environmentSubstitute(tableName);
	String realSchemaName = space.environmentSubstitute(schemaName);

    if (databaseMeta!=null)
    {
        Database db = new Database(loggingObject, databaseMeta);
        try
        {
            db.connect();

            if (!Const.isEmpty(realTableName))
            {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                // Check if this table exists...
                if (db.checkTableExists(schemaTable))
                {
                    return db.getTableFields(schemaTable);
                }
                else
                {
                    throw new KettleException(BaseMessages.getString(PKG, "MonetDBBulkLoaderMeta.Exception.TableNotFound"));
                }
            }
            else
            {
                throw new KettleException(BaseMessages.getString(PKG, "MonetDBBulkLoaderMeta.Exception.TableNotSpecified"));
            }
        }
        catch(Exception e)
        {
            throw new KettleException(BaseMessages.getString(PKG, "MonetDBBulkLoaderMeta.Exception.ErrorGettingFields"), e);
        }
        finally
        {
            db.disconnect();
        }
    }
    else
    {
        throw new KettleException(BaseMessages.getString(PKG, "MonetDBBulkLoaderMeta.Exception.ConnectionNotDefined"));
    }

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:MonetDBBulkLoaderMeta.java

示例12: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
{
	String realTableName = space.environmentSubstitute(tableName);
	String realSchemaName = space.environmentSubstitute(schemaName);

    if (databaseMeta!=null)
    {
        Database db = new Database(loggingObject, databaseMeta);
        try
        {
            db.connect();

            if (!Const.isEmpty(realTableName))
            {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                // Check if this table exists...
                if (db.checkTableExists(schemaTable))
                {
                    return db.getTableFields(schemaTable);
                }
                else
                {
                    throw new KettleException(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.Exception.TableNotFound"));
                }
            }
            else
            {
                throw new KettleException(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.Exception.TableNotSpecified"));
            }
        }
        catch(Exception e)
        {
            throw new KettleException(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.Exception.ErrorGettingFields"), e);
        }
        finally
        {
            db.disconnect();
        }
    }
    else
    {
        throw new KettleException(BaseMessages.getString(PKG, "LucidDBBulkLoaderMeta.Exception.ConnectionNotDefined"));
    }

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:LucidDBBulkLoaderMeta.java

示例13: getRequiredFields

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
  {
String realTableName = space.environmentSubstitute(tableName);
String realSchemaName = space.environmentSubstitute(schemaName);

      if (databaseMeta!=null)
      {
          Database db = new Database(loggingObject, databaseMeta);
          try
          {
              db.connect();
              
              if (!Const.isEmpty(realTableName))
              {
                  String schemaTable = databaseMeta.getQuotedSchemaTableCombination(realSchemaName, realTableName);

                  // Check if this table exists...
                  if (db.checkTableExists(schemaTable))
                  {
                      return db.getTableFields(schemaTable);
                  }
                  else
                  {
                      throw new KettleException(BaseMessages.getString(PKG, "SynchronizeAfterMergeMeta.Exception.TableNotFound"));
                  }
              }
              else
              {
                  throw new KettleException(BaseMessages.getString(PKG, "SynchronizeAfterMergeMeta.Exception.TableNotSpecified"));
              }
          }
          catch(Exception e)
          {
              throw new KettleException(BaseMessages.getString(PKG, "SynchronizeAfterMergeMeta.Exception.ErrorGettingFields"), e);
          }
          finally
          {
              db.disconnect();
          }
      }
      else
      {
          throw new KettleException(BaseMessages.getString(PKG, "SynchronizeAfterMergeMeta.Exception.ConnectionNotDefined"));
      }

  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:SynchronizeAfterMergeMeta.java

示例14: getListColumns

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Get a list of columns
 */
private void getListColumns()
{
	if (!Const.isEmpty(wTablename.getText()))
	{
		DatabaseMeta databaseMeta = jobMeta.findDatabase(wConnection.getText());
		if (databaseMeta!=null)
		{
			Database database = new Database(loggingObject, databaseMeta);
			database.shareVariablesWith(jobMeta);
			try
			{
				database.connect();
				String schemaTable = databaseMeta.getQuotedSchemaTableCombination(jobMeta.environmentSubstitute(wSchemaname.getText()), jobMeta.environmentSubstitute(wTablename.getText()));
				RowMetaInterface row = database.getTableFields(schemaTable);
				if(row!=null)
				{
					String available[] = row.getFieldNames();
			
					wFields.removeAll();
					for (int i=0;i<available.length;i++) 
					{
						wFields.add(available[i]);
					}
					wFields.removeEmptyRows();
					wFields.setRowNums();
				}else
				{
					MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
					mb.setMessage(BaseMessages.getString(PKG, "JobEntryColumnsExist.GetListColumsNoRow.DialogMessage"));
					mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
					mb.open(); 
				}
			}
			catch(Exception e)
			{
				new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "JobEntryColumnsExist.ConnectionError2.DialogMessage",wTablename.getText()), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:48,代码来源:JobEntryColumnsExistDialog.java

示例15: getListColumns

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Get a list of columns, comma separated, allow the user to select from it.
 *
 */
private void getListColumns()
{
    if (!Const.isEmpty(wTablename.getText()))
    {
        DatabaseMeta databaseMeta = jobMeta.findDatabase(wConnection.getText());
        if (databaseMeta!=null)
        {
            Database database = new Database(loggingObject, databaseMeta);
            database.shareVariablesWith(jobMeta);
            try
            {
                database.connect();
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(wSchemaname.getText(), wTablename.getText());
                RowMetaInterface row = database.getTableFields(schemaTable);
                String available[] = row.getFieldNames();
                
                String source[] = wListColumn.getText().split(",");
                for (int i=0;i<source.length;i++) source[i] = Const.trim(source[i]);
                int idxSource[] = Const.indexsOfStrings(source, available);
                EnterSelectionDialog dialog = new EnterSelectionDialog(shell, available, BaseMessages.getString(PKG, "JobMysqlBulkFile.SelectColumns.Title"), BaseMessages.getString(PKG, "JobMysqlBulkFile.SelectColumns.Message"));
                dialog.setMulti(true);
                dialog.setAvoidQuickSearch();
                dialog.setSelectedNrs(idxSource);
                if (dialog.open()!=null)
                {
                    String columns="";
                    int idx[] = dialog.getSelectionIndeces();
                    for (int i=0;i<idx.length;i++)
                    {
                        if (i>0) columns+=", ";
                        columns+=available[idx[i]];
                    }
                    wListColumn.setText(columns);
                }
            }
            catch(KettleDatabaseException e)
            {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "JobMysqlBulkFile.ConnectionError2.DialogMessage"), e);
            }
            finally
            {
                database.disconnect();
            }
        }
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:51,代码来源:JobEntryMysqlBulkFileDialog.java


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