Ejemplo n.º 1
0
  public String returnExecuteQueryStringsAsString(String xquery) throws PersistanceException {

    Connection conn = null;
    Statement statement = null;
    ResultSet resultSet = null;
    List list = new ArrayList(5);
    StringBuffer buf = new StringBuffer();
    try {
      conn = TLConnectionPool.getTLConnectionPool().borrowConnection();
      statement = conn.createStatement();
      statement.setQueryOption(QueryOption.XMLSPACE, "preserve");
      resultSet = statement.execute(xquery);
      while (resultSet.next()) {
        String s = resultSet.getString();
        // list.add(resultSet.getString());
        buf.append(s);
        System.out.println("--------TLQR --------->>> " + s);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new PersistanceException(ex);
    } finally {
      try {
        if (resultSet != null) resultSet.close();
        if (statement != null) statement.close();
        TLConnectionPool.getTLConnectionPool().returnConnection(conn);
      } catch (Exception ex) {
      }
    }
    return buf.toString();
  }
Ejemplo n.º 2
0
  /**
   * Run the query aganist TL and return result as list of strings.
   *
   * @param xquery
   * @return
   * @throws PersistanceException
   */
  public List returnExecuteQueryStrings(String xquery) throws PersistanceException {

    Connection conn = null;
    Statement statement = null;
    ResultSet resultSet = null;
    List list = new ArrayList(5);
    try {
      conn = TLConnectionPool.getTLConnectionPool().borrowConnection();
      statement = conn.createStatement();
      statement.setQueryOption(QueryOption.XMLSPACE, "preserve");
      resultSet = statement.execute(xquery);
      while (resultSet.next()) {
        list.add(resultSet.getString());
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new PersistanceException(ex);
    } finally {
      try {
        if (resultSet != null) resultSet.close();
        if (statement != null) statement.close();
        TLConnectionPool.getTLConnectionPool().returnConnection(conn);
      } catch (Exception ex) {
      }
    }
    return list;
  }