Examples of ITableInfo


Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

  protected void onExecute() throws SQLException
  {
    if (!(_info[0] instanceof ITableInfo))
      return;

    ITableInfo ti = (ITableInfo) _info[0];

    ForeignKeyInfo[] fkInfo = _session.getMetaData().getImportedKeysInfo(ti);

    // Don't show foreignKeys dialog if only one index exists to be modified
    if (fkInfo.length == 1)
    {
      _foreignKeyInfo = fkInfo;
      showCustomDialog();
    } else if (fkInfo.length == 0)
    {
      _session.showErrorMessage(s_stringMgr.getString("DropForeignKeyCommand.noKeyToDrop",
        _info[0].getSimpleName()));
    } else
    {
      _listDialog =
        new DefaultListDialog(fkInfo, ti.getSimpleName(), DefaultListDialog.DIALOG_TYPE_FOREIGN_KEY);
      _listDialog.addColumnSelectionListener(new ColumnListSelectionActionListener());
      _listDialog.setLocationRelativeTo(_session.getApplication().getMainFrame());
      _listDialog.setVisible(true);
    }
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

    {
      final IObjectTreeAPI treeAPI = _session.getSessionInternalFrame().getObjectTreeAPI();
      final IDatabaseObjectInfo[] tables = treeAPI.getSelectedDatabaseObjects();
      if (tables.length == 1)
      {
        final ITableInfo ti = (ITableInfo)tables[0];
        final String msg = s_stringMgr.getString("RenameTableAction.newnameprompt", ti.getQualifiedName());
        final String title = s_stringMgr.getString("RenameTableAction.rename");
        final String newTableName = JOptionPane.showInputDialog(null, msg, title, JOptionPane.QUESTION_MESSAGE);
        if (newTableName != null && newTableName.length() > 0)
        {
          try
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

        + _info[0].getClass().getName());

      return;
    }

    ITableInfo ti = (ITableInfo) _info[0];
    TableColumnInfo[] columns = _session.getSQLConnection().getSQLMetaData().getColumnInfo(ti);

    if (columns.length < 2)
    {
      // If the table has only one column, it cannot be dropped
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

    return dialect.supportsDropColumn();
  }
 
  private void showCustomDialog() throws SQLException
  {
    ITableInfo ti = (ITableInfo) _info[0];
    TableColumnInfo[] columns = _session.getMetaData().getColumnInfo(ti);

    // Show the user a dialog with a list of columns and ask them to select
    customDialog = new ColumnListDialog(columns, ColumnListDialog.DROP_COLUMN_MODE);
    customDialog.setMultiSelection();
    customDialog.setTableName(ti.getQualifiedName());

    customDialog.addColumnSelectionListener(new ExecuteListener());
    customDialog.addEditSQLListener(new EditSQLListener(customDialog));
    customDialog.addShowSQLListener(new ShowSQLListener(i18n.SHOWSQL_DIALOG_TITLE, customDialog));
    customDialog.setLocationRelativeTo(_session.getApplication().getMainFrame());
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

    return dialectExt.supportsAddForeignKeyConstraint();
  }

  private void showCustomDialog() throws SQLException
  {
    final ITableInfo selectedTable = (ITableInfo) _info[0];
    String schema = selectedTable.getSchemaName();
    String catalog = selectedTable.getCatalogName();
    ITableInfo[] tables = _session.getSchemaInfo().getITableInfos(catalog, schema);

    TableColumnInfo[] tableColumnInfos = _session.getMetaData().getColumnInfo(selectedTable);
    if (tableColumnInfos == null || tableColumnInfos.length == 0)
    {
      _session.showErrorMessage(s_stringMgr.getString("AddForeignKeyCommand.noColumns",
        selectedTable.getSimpleName()));
      return;
    }

    final TreeSet<String> localColumns = new TreeSet<String>();
    for (TableColumnInfo columns : tableColumnInfos)
    {
      localColumns.add(columns.getColumnName());
    }

    final HashMap<String, TableColumnInfo[]> allTables = new HashMap<String, TableColumnInfo[]>();
    for (ITableInfo table : tables)
    {
      if (table.getDatabaseObjectType() == DatabaseObjectType.TABLE)
      {
        TableColumnInfo[] columnInfos = _session.getMetaData().getColumnInfo(table);
        if (columnInfos != null && columnInfos.length > 0)
        {
          allTables.put(table.getSimpleName(), _session.getMetaData().getColumnInfo(table));
        }
      }
    }

    _session.getApplication().getThreadPool().addTask(new Runnable()
    {
      public void run()
      {
        GUIUtils.processOnSwingEventThread(new Runnable()
        {
          public void run()
          {
            customDialog =
              new AddForeignKeyDialog(selectedTable.getSimpleName(),
                              localColumns.toArray(new String[] {}),
                              allTables);
            customDialog.addExecuteListener(new ExecuteListener());
            customDialog.addEditSQLListener(new EditSQLListener(customDialog));
            customDialog.addShowSQLListener(new ShowSQLListener(i18n.SHOWSQL_DIALOG_TITLE, customDialog));
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

    return dialectExt.supportsCreateIndex();
  }

  private void showCustomDialog() throws SQLException
  {
    ITableInfo selectedTable = (ITableInfo) _info[0];
    TableColumnInfo[] tableColumnInfos = _session.getMetaData().getColumnInfo(selectedTable);
    TreeSet<String> localColumns = new TreeSet<String>();
    for (TableColumnInfo columns : tableColumnInfos)
    {
      localColumns.add(columns.getColumnName());
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

    if (!(_info[0] instanceof ITableInfo))
    {
      return;
    }

    ITableInfo ti = (ITableInfo) _info[0];
    PrimaryKeyCommandUtility pkcUtil = new PrimaryKeyCommandUtility(_session, _info);
    if (pkcUtil.tableHasPrimaryKey())
    {
      _session.showErrorMessage(s_stringMgr.getString("AddPrimaryKeyCommand.primaryKeyExists",
        ti.getSimpleName()));
    } else
    {
      showCustomDialog();
    }
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

  /**
   * @throws SQLException
   */
  public void showCustomDialog() throws SQLException
  {
    ITableInfo ti = (ITableInfo) _info[0];
    TableColumnInfo[] columns = _session.getMetaData().getColumnInfo(ti);
    if (columns == null || columns.length == 0)
    {
      _session.showErrorMessage(s_stringMgr.getString("AddPrimaryKeyCommand.noColumns", ti.getSimpleName()));
      return;
    }

    // Show the user a dialog with a list of columns and ask them to select one or more columns to drop
    customDialog = new ColumnListDialog(columns, ColumnListDialog.ADD_PRIMARY_KEY_MODE);
    customDialog.setTableName(ti.getQualifiedName());
    // Set a default primary key name based on the name of the table
    customDialog.setPrimaryKeyName("PK_" + columns[0].getTableName().toUpperCase());

    customDialog.addColumnSelectionListener(new ExecuteListener());
    customDialog.addEditSQLListener(new EditSQLListener(customDialog));
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

  }

  private void showCustomDialog() throws SQLException
  {
    ISQLDatabaseMetaData md = _session.getMetaData();
    ITableInfo selectedTable = (ITableInfo) _info[0];
    TableColumnInfo[] tableColumnInfos = md.getColumnInfo(selectedTable);
    ForeignKeyInfo[] exportedKeys = md.getExportedKeysInfo(selectedTable);
    ForeignKeyInfo[] importedKeys = md.getImportedKeysInfo(selectedTable);

    _customDialog =
      new AddLookupTableDialog(selectedTable.getSimpleName(), getColumnNames(tableColumnInfos,
        exportedKeys,
        importedKeys));
    _customDialog.addExecuteListener(new ExecuteListener());
    _customDialog.addEditSQLListener(new EditSQLListener(_customDialog));
    _customDialog.addShowSQLListener(new ShowSQLListener(i18n.SHOWSQL_DIALOG_TITLE, _customDialog));
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.sql.ITableInfo

      ScriptTargetCollection targets = new ScriptTargetCollection();
      for (int i = 0; i < dbObjs.length; i++)
      {
        if(dbObjs[i].getDatabaseObjectType().equals(DatabaseObjectType.TABLE))
        {
          ITableInfo tableInfo = (ITableInfo) dbObjs[i];
          if("VIEW".equals(tableInfo.getType()))
          {
            targets.add(new ScriptTarget(dbObjs[i].getSimpleName(), ScriptTarget.DB_OBJECT_TYPE_VIEW));
          }
          else if("TABLE".equals(tableInfo.getType()) || "SYSTEM TABLE".equals(tableInfo.getType()))
          {
            targets.add(new ScriptTarget(dbObjs[i].getSimpleName(), ScriptTarget.DB_OBJECT_TYPE_TABLE));
          }
        }
        else if(dbObjs[i].getDatabaseObjectType().equals(DatabaseObjectType.PROCEDURE))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.