/** * Return SQL CREATION statement for a Table * * @param tableName The table to create * @throws KettleDatabaseException */ public String getDDLCreationTable( String tableName, RowMetaInterface fields ) throws KettleDatabaseException { String retval; // First, check for reserved SQL in the input row r... databaseMeta.quoteReservedWords( fields ); String quotedTk = databaseMeta.quoteField( null ); retval = getCreateTableStatement( tableName, fields, quotedTk, false, null, true ); return retval; }
public String getDDL( String tableName, RowMetaInterface fields, String tk, boolean use_autoinc, String pk, boolean semicolon ) throws KettleDatabaseException { String retval; // First, check for reserved SQL in the input row r... databaseMeta.quoteReservedWords( fields ); String quotedTk = tk != null ? databaseMeta.quoteField( tk ) : null; if ( checkTableExists( tableName ) ) { retval = getAlterTableStatement( tableName, fields, quotedTk, use_autoinc, pk, semicolon ); } else { retval = getCreateTableStatement( tableName, fields, quotedTk, use_autoinc, pk, semicolon ); } return retval; }
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
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(); } }
.getCreateTableStatement( tableName, data.db.getTableFieldsMeta( data.realSchemaName, tableName ),