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


Java DatabaseMeta.getQuotedSchemaTableCombination方法代码示例

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


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

示例1: getLookup

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
 * Get the fields from the table in the database and use them as lookup keys.
 * Only get the the fields which are not yet in use as key, or in the field
 * table. Also ignore technical key, version, fromdate, todate.
 */
private void getLookup() {
  DatabaseMeta databaseMeta = transMeta.findDatabase(wConnection.getText());
  if (databaseMeta != null) {
    Database db = new Database(loggingObject, databaseMeta);
    db.shareVariablesWith(transMeta);
    try {
      db.connect();
      String schemaTable = databaseMeta.getQuotedSchemaTableCombination(wSchema.getText(), wTable.getText());
      RowMetaInterface r = db.getTableFields(schemaTable);
      if (r != null && !r.isEmpty()) {
        BaseStepDialog.getFieldsFromPrevious(r, wUpIns, 2, new int[] { 1, 2 }, new int[] { 3 }, -1, -1, new TableItemInsertListener() {
          public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
            int idx = wKey.indexOfString(v.getName(), 2);
            if (idx < 0 && !v.getName().equalsIgnoreCase(wTk.getText()) && !v.getName().equalsIgnoreCase(wVersion.getText()) && !v.getName().equalsIgnoreCase(wFromdate.getText()) && !v.getName().equalsIgnoreCase(wTodate.getText())) {
              return true;
            }
            return false;
          }
        });
      }
    } catch (KettleException e) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.ErrorOccurred.DialogTitle")); //$NON-NLS-1$
      mb.setMessage(BaseMessages.getString(PKG, "DimensionLookupDialog.ErrorOccurred.DialogMessage") + Const.CR + e.getMessage()); //$NON-NLS-1$
      mb.open();
    } finally {
      db.disconnect();
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:36,代码来源:DimensionLookupDialog.java

示例2: GetPreviewTableProgressDialog

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
 * Creates a new dialog that will handle the wait while we're doing the hard work.
 */
public GetPreviewTableProgressDialog(Shell shell, DatabaseMeta dbInfo, String schemaName, String tableName, int limit)
{
	this.shell = shell;
	this.dbMeta = dbInfo;
	this.tableName = dbInfo.getQuotedSchemaTableCombination(schemaName, tableName);
	this.limit = limit;
   }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:GetPreviewTableProgressDialog.java

示例3: getSchemaAndTable

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
private String getSchemaAndTable(XulDatabaseExplorerModel model, DatabaseMeta meta) {
if (model.getSchema() != null) {
  return meta.getQuotedSchemaTableCombination(model.getSchema(), model.getTable());
} else {
  return meta.getQuotedSchemaTableCombination(null, model.getTable());
}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:8,代码来源:XulDatabaseExplorerController.java

示例4: loadAllTableDataIntoTheCache

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
private void loadAllTableDataIntoTheCache() throws KettleException {
   	DatabaseMeta dbMeta = meta.getDatabaseMeta();
   	
   	try {
    	// We only want to get the used table fields...
    	//
    	String sql = "SELECT ";
    	
           for (int i=0;i<meta.getStreamKeyField1().length;i++)
           {
           	if (i>0) sql+=", ";
           	sql+=dbMeta.quoteField(meta.getTableKeyField()[i]);
           }

    	// Also grab the return field...
    	//
    	for (int i=0;i<meta.getReturnValueField().length;i++) {
    		sql+=", "+dbMeta.quoteField(meta.getReturnValueField()[i]);
    	}
    	// The schema/table
    	//
    	sql+=" FROM "+dbMeta.getQuotedSchemaTableCombination(environmentSubstitute(meta.getSchemaName()), environmentSubstitute(meta.getTablename()));
    	
    	// order by?
		if (meta.getOrderByClause()!=null && meta.getOrderByClause().length()!=0)
		{
			sql += " ORDER BY "+meta.getOrderByClause();
		}
    	
    	// Now that we have the SQL constructed, let's store the rows...
    	//
    	List<Object[]> rows = data.db.getRows(sql, 0);
    	if (rows!=null && rows.size()>0) {
    		RowMetaInterface returnRowMeta = data.db.getReturnRowMeta();
    		// Copy the data into 2 parts: key and value...
    		// 
    		for (Object[] row : rows) {
    			int index=0;
    			RowMeta keyMeta = new RowMeta();
    			Object[] keyData = new Object[meta.getStreamKeyField1().length];
    			for (int i=0;i<meta.getStreamKeyField1().length;i++) {
    				keyData[i] = row[index];
    				keyMeta.addValueMeta(returnRowMeta.getValueMeta(index++));
    			}
    			// RowMeta valueMeta = new RowMeta();
    			Object[] valueData = new Object[data.returnMeta.size()];
    			for (int i=0;i<data.returnMeta.size();i++) {
    				valueData[i] = row[index++];
    				// valueMeta.addValueMeta(returnRowMeta.getValueMeta(index++));
    			}
    			// Store the data...
    			//
    			storeRowInCache(keyMeta, keyData, valueData);
    			incrementLinesInput();
    		}
    	}
   	}
   	catch(Exception e) {
   		throw new KettleException(e);
   	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:62,代码来源:DatabaseLookup.java

示例5: getCopyCommand

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
 * Get the contents of the control file as specified in the meta object
 * 
 * @param meta the meta object to model the control file after
 * 
 * @return a string containing the control file contents
 */
public String getCopyCommand(RowMetaInterface rm, Object[] r) throws KettleException
{
	DatabaseMeta dm = meta.getDatabaseMeta();

	String loadAction = meta.getLoadAction();

	StringBuffer contents = new StringBuffer(500);

       String tableName = dm.getQuotedSchemaTableCombination(
           environmentSubstitute(meta.getSchemaName()),
           environmentSubstitute(meta.getTableName()));
       
       // Set the date style...
       //
       // contents.append("SET DATESTYLE ISO;"); // This is the default but we set it anyway...
       // contents.append(Const.CR);

       // Create a Postgres / Greenplum COPY string for use with a psql client
       if (loadAction.equalsIgnoreCase("truncate")) {
           contents.append("TRUNCATE TABLE ");
           contents.append(tableName + ";");
           contents.append(Const.CR);
       }
       contents.append("COPY ");
       // Table name

       contents.append(tableName);

       // Names of columns

       contents.append(" ( ");

	String streamFields[] = meta.getFieldStream();
	String tableFields[] = meta.getFieldTable();

	if ( streamFields == null || streamFields.length == 0 )
	{
		throw new KettleException("No fields defined to load to database");
	}

	for (int i = 0; i < streamFields.length; i++)
	{
		if ( i!=0 ) contents.append(", ");
		contents.append(dm.quoteField(tableFields[i]));
       }

       contents.append(" ) ");

       // The "FROM" filename
       contents.append(" FROM STDIN"); // FIFO file

       // The "FORMAT" clause
       contents.append(" WITH CSV DELIMITER AS '").append(meta.getDelimiter()).append("' QUOTE AS '").append(meta.getEnclosure()).append("'");
       contents.append(";").append(Const.CR);

	return contents.toString();
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:65,代码来源:PGBulkLoader.java

示例6: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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(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[] = wListattribut.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, Messages.getString("JobMysqlBulkLoad.SelectColumns.Title"), Messages.getString("JobMysqlBulkLoad.SelectColumns.Message"));
				dialog.setMulti(true);
				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]];
					}
					wListattribut.setText(columns);
				}
			}
			catch(KettleDatabaseException e)
			{
				new ErrorDialog(shell, Messages.getString("System.Dialog.Error.Title"), Messages.getString("JobMysqlBulkLoad.ConnectionError2.DialogMessage"), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:49,代码来源:JobEntryMysqlBulkLoadDialog.java

示例7: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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(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, Messages.getString("JobMysqlBulkFile.SelectColumns.Title"), Messages.getString("JobMysqlBulkFile.SelectColumns.Message"));
                dialog.setMulti(true);
                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, Messages.getString("System.Dialog.Error.Title"), Messages.getString("JobMysqlBulkFile.ConnectionError2.DialogMessage"), e);
            }
            finally
            {
                database.disconnect();
            }
        }
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:50,代码来源:JobEntryMysqlBulkFileDialog.java

示例8: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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(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[] = wOrderBy.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, Messages.getString("JobMssqlBulkLoad.SelectColumns.Title"), Messages.getString("JobMssqlBulkLoad.SelectColumns.Message"));
				dialog.setMulti(true);
				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]];
					}
					wOrderBy.setText(columns);
				}
			}
			catch(KettleDatabaseException e)
			{
				new ErrorDialog(shell, Messages.getString("System.Dialog.Error.Title"), Messages.getString("JobMssqlBulkLoad.ConnectionError2.DialogMessage"), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:49,代码来源:JobEntryMssqlBulkLoadDialog.java

示例9: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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(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(Messages.getString("JobEntryColumnsExist.GetListColumsNoRow.DialogMessage"));
					mb.setText(Messages.getString("System.Dialog.Error.Title"));
					mb.open(); 
				}
			}
			catch(Exception e)
			{
				new ErrorDialog(shell, Messages.getString("System.Dialog.Error.Title"), Messages.getString("JobEntryColumnsExist.ConnectionError2.DialogMessage",wTablename.getText()), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:48,代码来源:JobEntryColumnsExistDialog.java

示例10: getLookup

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
 * Get the fields from the table in the database and use them as lookup 
 * keys. Only get the the fields which are not yet in use as key, or in 
 * the field table. Also ignore technical key, version, fromdate, todate.
 */
private void getLookup()
{
	DatabaseMeta databaseMeta = transMeta.findDatabase(wConnection.getText());
	if (databaseMeta!=null)
	{
		Database db = new Database(databaseMeta);
		db.shareVariablesWith(transMeta);
		try
		{
			db.connect();
               String schemaTable = databaseMeta.getQuotedSchemaTableCombination(wSchema.getText(), wTable.getText()); 
			RowMetaInterface r = db.getTableFields(schemaTable);
			if (r!=null && !r.isEmpty())
			{
                   BaseStepDialog.getFieldsFromPrevious(r, wUpIns, 2, new int[] { 1, 2 }, new int[] { 3 }, -1, -1, new TableItemInsertListener()
                       {
                           public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v)
                           {
                               int idx = wKey.indexOfString(v.getName(), 2);
                               if ( idx<0 &&
                                   !v.getName().equalsIgnoreCase(wTk.getText()) &&
                                   !v.getName().equalsIgnoreCase(wVersion.getText()) &&
                                   !v.getName().equalsIgnoreCase(wFromdate.getText()) &&
                                   !v.getName().equalsIgnoreCase(wTodate.getText())
                                   )
                               {
                                   return true;
                               }
                               return false;
                           }
                       }
                   );
			}
		}
		catch(KettleException e)
		{
			MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
			mb.setText(Messages.getString("DimensionLookupDialog.ErrorOccurred.DialogTitle")); //$NON-NLS-1$
			mb.setMessage(Messages.getString("DimensionLookupDialog.ErrorOccurred.DialogMessage")+Const.CR+e.getMessage()); //$NON-NLS-1$
			mb.open();
		}
		finally
		{
			db.disconnect();
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:53,代码来源:DimensionLookupDialog.java

示例11: getFieldsFromTable

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
private void getFieldsFromTable(){
	if(!gotTableFields)
	{
		if (!Const.isEmpty(wTable.getText())) {
			DatabaseMeta ci = transMeta.findDatabase(wConnection.getText());
			if (ci != null) {
				Database db = new Database(ci);
				try {
					db.connect();
					String schemaTable = ci	.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(wSchema.getText()), 
							transMeta.environmentSubstitute(wTable.getText()));
					RowMetaInterface r = db.getTableFields(schemaTable);
					if (null != r) {
						String[] fieldNames = r.getFieldNames();
						if (null != fieldNames) {
							// Version
							String version =wVersion.getText();
							wVersion.setItems(fieldNames);
							if(version!=null) wVersion.setText(version);
							// from date
							String fromdate =wFromdate.getText();
							wFromdate.setItems(fieldNames);
							if(fromdate!=null) wFromdate.setText(fromdate);
							// to date
							String todate =wTodate.getText();
							wTodate.setItems(fieldNames);
							if(todate!=null) wTodate.setText(todate);
							// tk
							String tk =wTk.getText();
							wTk.setItems(fieldNames);
							if(tk!=null) wTk.setText(tk);
							// AltStartDateField
							String sd =wAltStartDateField.getText();
							wAltStartDateField.setItems(fieldNames);
							if(sd!=null) wAltStartDateField.setText(sd);
						}
					}
				} catch (Exception e) {
					
					// ignore any errors here. drop downs will not be
					// filled, but no problem for the user
				}
			}
		}
		gotTableFields=true;
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:48,代码来源:DimensionLookupDialog.java

示例12: getLastExecutionResult

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
public static String getLastExecutionResult(LogChannelInterface log, LoggingObjectInterface parentObject, ReportSubjectLocation filename) throws KettleException {

	LogTableInterface logTable=null;
	if (filename.isTransformation()) {
		TransMeta transMeta = TransformationInformation.getInstance().getTransMeta(filename);
		logTable = transMeta.getTransLogTable();
	} else {
		JobMeta jobMeta  = JobInformation.getInstance().getJobMeta(filename);
		logTable = jobMeta.getJobLogTable();
	}
	if (logTable!=null && logTable.isDefined()) {
		DatabaseMeta dbMeta = logTable.getDatabaseMeta();
		Database database = new Database(parentObject, dbMeta);
		try {
			database.connect();
			String sql="SELECT ";
			sql+=dbMeta.quoteField(logTable.getStatusField().getFieldName())+", ";
			sql+=dbMeta.quoteField(logTable.getLogDateField().getFieldName())+", ";
			sql+=dbMeta.quoteField(logTable.getErrorsField().getFieldName())+"";
			sql+=" FROM ";
			sql+=dbMeta.getQuotedSchemaTableCombination(logTable.getSchemaName(), logTable.getTableName());
			sql+=" ORDER BY "+dbMeta.quoteField(logTable.getLogDateField().getFieldName())+" DESC";
			
			RowMetaAndData oneRow = database.getOneRow(sql);
			String status = oneRow.getString(0, "?");
			Date date = oneRow.getDate(1, null);
			Long nrErrors = oneRow.getInteger(2);
			
			String evaluation;
			if (status.equalsIgnoreCase(LogStatus.END.getStatus())) {
				evaluation = "Ended";
			} else if (status.equalsIgnoreCase(LogStatus.START.getStatus())) {
				evaluation = "Started";
			} else if (status.equalsIgnoreCase(LogStatus.STOP.getStatus())) {
				evaluation = "Stopped";
			} else if (status.equalsIgnoreCase(LogStatus.RUNNING.getStatus())) {
				evaluation = "Running";
			} else if (status.equalsIgnoreCase(LogStatus.PAUSED.getStatus())) {
				evaluation = "Paused";
			} else if (status.equalsIgnoreCase(LogStatus.ERROR.getStatus())) {
				evaluation = "Failed";
			} else {
				evaluation = "Unknown";
			}
			if (nrErrors>0) {
				evaluation+=" with errors";
			} else {
				evaluation+=" with success";
			}
			
			return evaluation+" at "+XMLHandler.date2string(date);
			
		} catch(Exception e) {
			log.logBasic("Unable to get logging information from log table"+logTable);
		} finally {
			database.disconnect();
		}
	}
	return null;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:61,代码来源:KettleFileTableModel.java

示例13: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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[] = wListattribut.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, "JobMysqlBulkLoad.SelectColumns.Title"), BaseMessages.getString(PKG, "JobMysqlBulkLoad.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]];
					}
					wListattribut.setText(columns);
				}
			}
			catch(KettleDatabaseException e)
			{
				new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "JobMysqlBulkLoad.ConnectionError2.DialogMessage"), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:50,代码来源:JobEntryMysqlBulkLoadDialog.java

示例14: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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

示例15: getListColumns

import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的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[] = wOrderBy.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, "JobMssqlBulkLoad.SelectColumns.Title"), BaseMessages.getString(PKG, "JobMssqlBulkLoad.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]];
					}
					wOrderBy.setText(columns);
				}
			}
			catch(KettleDatabaseException e)
			{
				new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "JobMssqlBulkLoad.ConnectionError2.DialogMessage"), e);
			}
			finally
			{
				database.disconnect();
			}
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:50,代码来源:JobEntryMssqlBulkLoadDialog.java


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