Package org.apache.jorphan.collections

Examples of org.apache.jorphan.collections.Data


     *            the TestElement to modify
     */
    @Override
    public void modifyTestElement(TestElement el) {
        GuiUtils.stopTableEditing(table);
        Data model = tableModel.getData();
        model.reset();
        while (model.next()) {
            el.setProperty(new StringProperty((String) model.getColumnValue(COLUMN_NAMES_0), (String) model
                    .getColumnValue(COLUMN_NAMES_1)));
        }
        super.configureTestElement(el);
    }
View Full Code Here


            if (SELECT.equals(_queryType)) {
              stmt = conn.createStatement();
        ResultSet rs = null;
        try {
          rs = stmt.executeQuery(getQuery());
          Data data = getDataFromResultSet(rs);
          res.setResponseData(data.toString().getBytes());
        } finally {
          close(rs);
        }
            } else if (CALLABLE.equals(_queryType)) {
              CallableStatement cstmt = getCallableStatement(conn);
View Full Code Here

    do {
      if (result) {
        ResultSet rs = null;
        try {
          rs = pstmt.getResultSet();
          Data data = getDataFromResultSet(rs);
          sb.append(data.toString()).append("\n"); // $NON-NLS-1$
        } finally {
          close(rs);
        }
      } else {
        sb.append(updateCount).append(" updates.\n");
View Full Code Here

   * @return a Data object
   * @throws java.sql.SQLException
   */
  private Data getDataFromResultSet(ResultSet rs) throws SQLException {
    ResultSetMetaData meta = rs.getMetaData();
    Data data = new Data();

    int numColumns = meta.getColumnCount();
    String[] dbCols = new String[numColumns];
    for (int i = 0; i < numColumns; i++) {
      dbCols[i] = meta.getColumnName(i + 1);
      data.addHeader(dbCols[i]);
    }

    while (rs.next()) {
      data.next();
      for (int i = 0; i < numColumns; i++) {
        Object o = rs.getObject(i + 1);
        if (o instanceof byte[]) {
          o = new String((byte[]) o);
        }
        data.addColumnValue(dbCols[i], o);
      }
    }
    return data;
  }
View Full Code Here

            if (SELECT.equals(_queryType)) {
              stmt = conn.createStatement();
        ResultSet rs = null;
        try {
          rs = stmt.executeQuery(getQuery());
          Data data = getDataFromResultSet(rs);
          res.setResponseData(data.toString().getBytes());
        } finally {
          close(rs);
        }
            } else if (CALLABLE.equals(_queryType)) {
              CallableStatement cstmt = getCallableStatement(conn);
View Full Code Here

    do {
      if (result) {
        ResultSet rs = null;
        try {
          rs = pstmt.getResultSet();
          Data data = getDataFromResultSet(rs);
          sb.append(data.toString()).append("\n"); // $NON-NLS-1$
        } finally {
          close(rs);
        }
      } else {
        sb.append(updateCount).append(" updates.\n");
View Full Code Here

   * @return a Data object
   * @throws java.sql.SQLException
   */
  private Data getDataFromResultSet(ResultSet rs) throws SQLException {
    ResultSetMetaData meta = rs.getMetaData();
    Data data = new Data();

    int numColumns = meta.getColumnCount();
    String[] dbCols = new String[numColumns];
    for (int i = 0; i < numColumns; i++) {
      dbCols[i] = meta.getColumnName(i + 1);
      data.addHeader(dbCols[i]);
    }

    while (rs.next()) {
      data.next();
      for (int i = 0; i < numColumns; i++) {
        Object o = rs.getObject(i + 1);
        if (o instanceof byte[]) {
          o = new String((byte[]) o);
        }
        data.addColumnValue(dbCols[i], o);
      }
    }
    return data;
  }
View Full Code Here

     * @param el
     *            the TestElement to modify
     */
    public void modifyTestElement(TestElement el) {
        GuiUtils.stopTableEditing(table);
        Data model = tableModel.getData();
        model.reset();
        while (model.next()) {
            el.setProperty(new StringProperty((String) model.getColumnValue(COLUMN_NAMES_0), (String) model
                    .getColumnValue(COLUMN_NAMES_1)));
        }
        super.configureTestElement(el);
    }
View Full Code Here

        return model.getColumnAsObjectArray(colName);
    }

    public void clearData() {
        String[] headers = model.getHeaders();
        model = new Data();
        model.setHeaders(headers);
        this.fireTableDataChanged();
    }
View Full Code Here

      // Based on query return value, get results
      if (isQueryOnly()) {
        ResultSet rs = null;
        try {
          rs = stmt.executeQuery(getQuery());
          Data data = getDataFromResultSet(rs);
          res.setResponseData(data.toString().getBytes());
        } finally {
          if (rs != null) {
            try {
              rs.close();
            } catch (SQLException exc) {
View Full Code Here

TOP

Related Classes of org.apache.jorphan.collections.Data

Copyright © 2018 www.massapicom. 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.