4.A.1.7.4.1. Oracle schema and table name
The following code can be placed in a configuration script action to hook it to the list of tables plugin support an Oracle database.
Example, in addition to how to use the BeanShell shows you how to get to the data contained in the results list.
Action title: What is a table (example BeanShell)
Action key: oracle-tables-actions
import pl.mpak.orbada.gui.comps.table.ViewTable; import pl.mpak.sky.gui.mr.ModalResult; import pl.mpak.sky.gui.swing.MessageBox; import pl.mpak.usedb.util.SQLUtil; if (component instanceof ViewTable) { ViewTable vt = (ViewTable)component; if (vt.getSelectedRow() >= 0) { try { vt.getQuery().getRecord(vt.getSelectedRow()); String schemaName = vt.getQuery().fieldByName("schema_name").getString(); String tableName = vt.getQuery().fieldByName("table_name").getString(); MessageBox.show(SQLUtil.createSqlName(schemaName, tableName)); } catch (Exception ex) { MessageBox.show("Error", ex.getMessage(), ModalResult.OK); } } }
4.A.1.7.4.2. Oracle quick copy a table DDL to clipboard
The following code can be placed in a configuration script action to hook it to the list of tables plugin support an Oracle database.
The example shows how you can use the Oracle plugin object SourceCreator
and copy the result to the clipboard of the operating system.
Action title: Quick copy DLL (example BeanShell)
Action key: oracle-tables-actions
import pl.mpak.orbada.gui.comps.table.ViewTable; import pl.mpak.sky.gui.mr.ModalResult; import pl.mpak.sky.gui.swing.MessageBox; import pl.mpak.orbada.oracle.util.SourceCreator; import pl.mpak.util.TextTransfer; if (component instanceof ViewTable) { ViewTable vt = (ViewTable)component; if (vt.getSelectedRow() >= 0) { try { vt.getQuery().getRecord(vt.getSelectedRow()); new TextTransfer().setClipboardContents( new SourceCreator(database, null).getSource( vt.getQuery().fieldByName("schema_name").getString(), "TABLE", vt.getQuery().fieldByName("table_name").getString())); } catch (Exception ex) { MessageBox.show("Problem", ex.getMessage(), ModalResult.OK); } } }