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


Java Database.getCreateTableStatement方法代码示例

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


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

示例1: getDDL

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDL(String tableName)
{
	Database db = new Database(dbMeta);
	try
	{
		db.connect();
		RowMetaInterface r = db.getTableFields(tableName);
		String sql = db.getCreateTableStatement(tableName, r, null, false, null, true);
		SQLEditor se = new SQLEditor(shell, SWT.NONE, dbMeta, dbcache, sql);
		se.open();
	}
	catch(KettleDatabaseException dbe)
	{
		new ErrorDialog(shell, Messages.getString("Dialog.Error.Header"),
               Messages.getString("DatabaseExplorerDialog.Error.RetrieveLayout"), dbe);
	}
	finally
	{
		db.disconnect();
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:DatabaseExplorerDialog.java

示例2: getDDL

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDL() {
  if(model.getTable() == null) {
    return;
  }
  Database db = new Database(null, this.model.getDatabaseMeta());
  try {
     db.connect();
     String tableName = getSchemaAndTable(this.model);
     RowMetaInterface r = db.getTableFields(tableName);
     String sql = db.getCreateTableStatement(tableName, r, null, false, null, true);
     SQLEditor se = new SQLEditor(this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model.getDatabaseMeta(), this.dbcache, sql);
     se.open();
  } catch (KettleDatabaseException dbe) {
    new ErrorDialog(this.dbExplorerDialog.getShell(), BaseMessages.getString(PKG, "Dialog.Error.Header"), BaseMessages.getString(PKG,  "DatabaseExplorerDialog.Error.RetrieveLayout"), dbe);
  } finally {
    db.disconnect();
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:XulDatabaseExplorerController.java

示例3: getDDL

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDL(String tableName)
{
	Database db = new Database(dbMeta);
	try
	{
		db.connect();
		RowMetaInterface r = db.getTableFields(tableName);
		String sql = db.getCreateTableStatement(tableName, r, null, false, null, true);
		SQLEditor se = new SQLEditor(dbMeta, shell, SWT.NONE, dbMeta, dbcache, sql);
		se.open();
	}
	catch(KettleDatabaseException dbe)
	{
		new ErrorDialog(shell, BaseMessages.getString(PKG,"Dialog.Error.Header"),
               BaseMessages.getString(PKG,"DatabaseExplorerDialog.Error.RetrieveLayout"), dbe);
	}
	finally
	{
		db.disconnect();
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:DatabaseExplorerDialogLegacy.java

示例4: createTables

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Create source table.
 */
public void createTables(Database db) throws Exception
{		
	String source = db.getCreateTableStatement(lookup_table, createSourceRowMetaInterface(), null, false, null, true);
	try  {
	    db.execStatement(source);
	}
	catch ( KettleException ex ) 
	{
		fail("failure while creating table " + lookup_table + ": " + ex.getMessage());	
	}						
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:15,代码来源:DatabaseLookupTest.java

示例5: createTable

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Create table for the normal case.
 */
public void createTable(Database db, String tableName, RowMetaInterface rm) throws Exception
{		
	String source = db.getCreateTableStatement(tableName, rm, null, false, null, true);
	try  {
	    db.execStatement(source);
	}
	catch ( KettleException ex ) 
	{
		fail("failure while creating table " + tableName + ": " + ex.getMessage());	
	}						
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:15,代码来源:TableOutputTest.java

示例6: createTables

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
/**
 * Create source table.
 */
public void createTables(Database db) throws Exception
{		
	String source = db.getCreateTableStatement(source_table, createSourceRowMetaInterface(), null, false, null, true);
	try  {
	    db.execStatement(source);
	}
	catch ( KettleException ex ) 
	{
		fail("failure while creating table " + source_table + ": " + ex.getMessage());	
	}						
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:15,代码来源:TableInputTest.java

示例7: getDDLForOther

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDLForOther(String tableName)
{
       if (databases!=null)
       {
   		Database db = new Database(dbMeta);
   		try
   		{
   			db.connect();
   			
   			RowMetaInterface r = db.getTableFields(tableName);
   
   			// Now select the other connection...
               
               // Only take non-SAP R/3 connections....
               List<DatabaseMeta> dbs = new ArrayList<DatabaseMeta>();
               for (int i=0;i<databases.size();i++) 
                   if ((databases.get(i)).getDatabaseType()!=DatabaseMeta.TYPE_DATABASE_SAPR3) dbs.add(databases.get(i));
               
               String conn[] = new String[dbs.size()];
   			for (int i=0;i<conn.length;i++) conn[i] = (dbs.get(i)).getName();
   			
   			EnterSelectionDialog esd = new EnterSelectionDialog(shell, conn, Messages.getString("DatabaseExplorerDialog.TargetDatabase.Title"),
                   Messages.getString("DatabaseExplorerDialog.TargetDatabase.Message"));
   			String target = esd.open();
   			if (target!=null)
   			{
   				DatabaseMeta targetdbi = DatabaseMeta.findDatabase(dbs, target);
   				Database targetdb = new Database(targetdbi);
   
   				String sql = targetdb.getCreateTableStatement(tableName, r, null, false, null, true);
   				SQLEditor se = new SQLEditor(shell, SWT.NONE, dbMeta, dbcache, sql);
   				se.open();
   			}
   		}
   		catch(KettleDatabaseException dbe)
   		{
   			new ErrorDialog(shell, Messages.getString("Dialog.Error.Header"),
                   Messages.getString("DatabaseExplorerDialog.Error.GenDDL"), dbe);
   		}
   		finally
   		{
   			db.disconnect();
   		}
       }
       else
       {
           MessageBox mb = new MessageBox(shell, SWT.NONE | SWT.ICON_INFORMATION);
           mb.setMessage(Messages.getString("DatabaseExplorerDialog.NoConnectionsKnown.Message"));
           mb.setText(Messages.getString("DatabaseExplorerDialog.NoConnectionsKnown.Title"));
           mb.open();
       }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:53,代码来源:DatabaseExplorerDialog.java

示例8: getDDLForOther

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDLForOther() {

    if (databases != null) {
      try {

        // Now select the other connection...

        // Only take non-SAP ERP connections....
        List<DatabaseMeta> dbs = new ArrayList<DatabaseMeta>();
        for (int i = 0; i < databases.size(); i++) {
          if (((databases.get(i)).getDatabaseInterface().isExplorable())) {
            dbs.add(databases.get(i));
          }
        }

        String conn[] = new String[dbs.size()];
        for (int i = 0; i < conn.length; i++)
          conn[i] = (dbs.get(i)).getName();

        EnterSelectionDialog esd = new EnterSelectionDialog(this.dbExplorerDialog.getShell(), conn, BaseMessages.getString(PKG,  "DatabaseExplorerDialog.TargetDatabase.Title"), BaseMessages.getString(PKG,  "DatabaseExplorerDialog.TargetDatabase.Message"));
        String target = esd.open();
        if (target != null) {
          DatabaseMeta targetdbi = DatabaseMeta.findDatabase(dbs, target);
          Database targetdb = new Database(null, targetdbi);
          try{
            targetdb.connect();
            String tableName = getSchemaAndTable(model);
            RowMetaInterface r = targetdb.getTableFields(tableName);

            String sql = targetdb.getCreateTableStatement(tableName, r, null, false, null, true);
            SQLEditor se = new SQLEditor(this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model.getDatabaseMeta(), this.dbcache, sql);
            se.open();
          } finally {
            targetdb.disconnect();
          }
        }
      } catch (KettleDatabaseException dbe) {
        new ErrorDialog(this.dbExplorerDialog.getShell(), BaseMessages.getString(PKG, "Dialog.Error.Header"), BaseMessages.getString(PKG, "DatabaseExplorerDialog.Error.GenDDL"), dbe);
      }
    } else {
      MessageBox mb = new MessageBox(this.dbExplorerDialog.getShell(), SWT.NONE | SWT.ICON_INFORMATION);
      mb.setMessage(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoConnectionsKnown.Message"));
      mb.setText(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoConnectionsKnown.Title"));
      mb.open();
    }
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:XulDatabaseExplorerController.java

示例9: getDDLForOther

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public void getDDLForOther(String tableName)
{
       if (databases!=null)
       {
   		Database db = new Database(dbMeta);
   		try
   		{
   			db.connect();
   			
   			RowMetaInterface r = db.getTableFields(tableName);
   
   			// Now select the other connection...
               
               // Only take non-SAP ERP connections....
               List<DatabaseMeta> dbs = new ArrayList<DatabaseMeta>();
               for (int i=0;i<databases.size();i++) {
                   if (!((databases.get(i)).getDatabaseInterface() instanceof SAPR3DatabaseMeta)) {
                   	dbs.add(databases.get(i));
                   }
               }
               
               String conn[] = new String[dbs.size()];
   			for (int i=0;i<conn.length;i++) conn[i] = (dbs.get(i)).getName();
   			
   			EnterSelectionDialog esd = new EnterSelectionDialog(shell, conn, BaseMessages.getString(PKG,"DatabaseExplorerDialog.TargetDatabase.Title"),
                   BaseMessages.getString(PKG,"DatabaseExplorerDialog.TargetDatabase.Message"));
   			String target = esd.open();
   			if (target!=null)
   			{
   				DatabaseMeta targetdbi = DatabaseMeta.findDatabase(dbs, target);
   				Database targetdb = new Database(targetdbi);
   
   				String sql = targetdb.getCreateTableStatement(tableName, r, null, false, null, true);
   				SQLEditor se = new SQLEditor(dbMeta, shell, SWT.NONE, dbMeta, dbcache, sql);
   				se.open();
   			}
   		}
   		catch(KettleDatabaseException dbe)
   		{
   			new ErrorDialog(shell, BaseMessages.getString(PKG,"Dialog.Error.Header"),
                   BaseMessages.getString(PKG,"DatabaseExplorerDialog.Error.GenDDL"), dbe);
   		}
   		finally
   		{
   			db.disconnect();
   		}
       }
       else
       {
           MessageBox mb = new MessageBox(shell, SWT.NONE | SWT.ICON_INFORMATION);
           mb.setMessage(BaseMessages.getString(PKG,"DatabaseExplorerDialog.NoConnectionsKnown.Message"));
           mb.setText(BaseMessages.getString(PKG,"DatabaseExplorerDialog.NoConnectionsKnown.Title"));
           mb.open();
       }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:56,代码来源:DatabaseExplorerDialogLegacy.java


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