當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseMeta.getID方法代碼示例

本文整理匯總了Java中org.pentaho.di.core.database.DatabaseMeta.getID方法的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseMeta.getID方法的具體用法?Java DatabaseMeta.getID怎麽用?Java DatabaseMeta.getID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.pentaho.di.core.database.DatabaseMeta的用法示例。


在下文中一共展示了DatabaseMeta.getID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ClassicDatabaseDialog

import org.pentaho.di.core.database.DatabaseMeta; //導入方法依賴的package包/類
public ClassicDatabaseDialog(Shell parent, DatabaseMeta databaseMeta)
{
    super(parent, SWT.NONE);
    this.databaseMeta = databaseMeta;
    this.databaseName = databaseMeta.getName();
    this.props = PropsUI.getInstance();
    this.databases = null;
    this.extraOptions = databaseMeta.getExtraOptions();
    this.database_id = databaseMeta.getID();
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:11,代碼來源:ClassicDatabaseDialog.java

示例2: saveDatabaseMeta

import org.pentaho.di.core.database.DatabaseMeta; //導入方法依賴的package包/類
/**
 * Saves the database information into a given repository.
 * 
 * @param databaseMeta The database metadata object to store
 * @param rep The repository to save the database into.
 * 
 * @throws KettleException if an error occurs.
 */
public static void saveDatabaseMeta(DatabaseMeta databaseMeta, Repository rep) throws KettleException
{
	try
	{
           // If we don't have an ID, we don't know which entry in the database we need to update.
		// See if a database with the same name is already available...
		if (databaseMeta.getID()<=0)
		{
			databaseMeta.setID(rep.getDatabaseID(databaseMeta.getName()));
		}
		
		// Still not found? --> Insert
		if (databaseMeta.getID()<=0)
		{
			// Insert new Note in repository
			databaseMeta.setID(rep.insertDatabase(	databaseMeta.getName(), 
										DatabaseMeta.getDatabaseTypeCode(databaseMeta.getDatabaseType()), 
										DatabaseMeta.getAccessTypeDesc(databaseMeta.getAccessType()), 
										databaseMeta.getHostname(), 
										databaseMeta.getDatabaseName(), 
										databaseMeta.getDatabasePortNumberString(), 
										databaseMeta.getUsername(), 
										databaseMeta.getPassword(),
										databaseMeta.getServername(),
										databaseMeta.getDataTablespace(),
										databaseMeta.getIndexTablespace()
									)
				); 
		}
		else // --> found entry with the same name...
		{
			// Update the note...
			rep.updateDatabase(	databaseMeta.getID(),
					databaseMeta.getName(), 
										DatabaseMeta.getDatabaseTypeCode(databaseMeta.getDatabaseType()), 
										DatabaseMeta.getAccessTypeDesc(databaseMeta.getAccessType()), 
										databaseMeta.getHostname(), 
										databaseMeta.getDatabaseName(), 
										databaseMeta.getDatabasePortNumberString(), 
										databaseMeta.getUsername(), 
										databaseMeta.getPassword(),
										databaseMeta.getServername(),
										databaseMeta.getDataTablespace(),
										databaseMeta.getIndexTablespace()
									);
		}
           
           // For the extra attributes, just delete them and re-add them.
           rep.delDatabaseAttributes(databaseMeta.getID());
           
           // OK, now get a list of all the attributes set on the database connection...
           // 
           Properties attributes = databaseMeta.getAttributes();
           Enumeration<Object> keys = databaseMeta.getAttributes().keys();
           while (keys.hasMoreElements())
           {
               String code = (String) keys.nextElement();
               String attribute = (String)attributes.get(code);
               
               // Save this attribute
               rep.insertDatabaseAttribute(databaseMeta.getID(), code, attribute);
           }
	}
	catch(KettleDatabaseException dbe)
	{
		throw new KettleException("Error saving database connection or one of its attributes to the repository.", dbe);
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:77,代碼來源:RepositoryUtil.java


注:本文中的org.pentaho.di.core.database.DatabaseMeta.getID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。