Package javax.sql.rowset

Examples of javax.sql.rowset.CachedRowSet


          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateDouble(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here


          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateLong(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateBoolean(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateShort(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateString(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

  private void populateResults(PreparedStatement ps, ResultSet rs) throws SQLException {
    if (rs == null) {
      resultSet = null;
    }
    else {
      CachedRowSet rowSet = new CachedRowSetImpl();
      final ResultSetMetaData md = new DelegatingResultSetMetaData(rs.getMetaData()) {
        @Override
        public int getScale(int column) throws SQLException {
          int result = super.getScale(column);
          if (result < 0) {
            result = 0;
          }
          return result;
       
      };
     
      ResultSet rsNew = new DelegatingResultSet(rs) {
        @Override
        public ResultSetMetaData getMetaData() throws SQLException {
          return md;
        }
      };
     
      rowSet.populate(rsNew);
      resultSet = rowSet;
     
      this.resultSetType = rs.getType();
      this.resultSetConcurrency = rs.getConcurrency();
    }
View Full Code Here

    }
  }

  public void testBug49516() throws Exception {

    CachedRowSet crs;

    createTable(
        "bug49516",
        "(`testingID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `firstName` TEXT NOT NULL) CHARACTER SET utf8;");
    this.stmt.executeUpdate("insert into bug49516 set firstName ='John'");

    this.rs = this.stmt
        .executeQuery("select firstName as 'first person' from bug49516");
    this.rs.first();
    assertEquals("John", this.rs.getString("first person"));
    // this.rs.close();
    // this.stmt.close();

    this.rs = this.stmt
        .executeQuery("select firstName as 'first person' from bug49516");

    crs = (CachedRowSet)Class.forName("com.sun.rowset.CachedRowSetImpl").newInstance();
    crs.populate(this.rs);
    crs.first();

    assertEquals("John", crs.getString(1));
  }
View Full Code Here

    assertEquals("John", crs.getString(1));
  }

  public void testBug48820() throws Exception {

    CachedRowSet crs;

    Connection noBlobsConn = getConnectionWithProps("functionsNeverReturnBlobs=true");
   
    if (versionMeetsMinimum(5, 6, 6)) {
      this.rs = noBlobsConn.createStatement().executeQuery("SHOW VARIABLES LIKE 'old_passwords'");
      if (this.rs.next()) {
        if (this.rs.getInt(2) == 2) {
          System.out.println("Skip testBug48820 due to SHA-256 password hashing.");
          return;
        }
      }
    }

    this.rs = noBlobsConn.createStatement().executeQuery(
        "SELECT PASSWORD ('SOMETHING')");
    this.rs.first();

    String fromPlainResultSet = this.rs.getString(1);

    this.rs = noBlobsConn.createStatement().executeQuery(
        "SELECT PASSWORD ('SOMETHING')");

    crs = (CachedRowSet)Class.forName("com.sun.rowset.CachedRowSetImpl").newInstance();
    crs.populate(this.rs);
    crs.first();

    assertEquals(fromPlainResultSet, crs.getString(1));
  }
View Full Code Here

    public DBDataSet(PreparedStatement pStatement, ResultSet pResults, boolean pAllowOffline) {
        super();
        this.statement = pStatement;
        if (pAllowOffline) {
          try {
            CachedRowSet rowSet = new CachedRowSetImpl();
            rowSet.populate(pResults);
              this.resultSet = rowSet;
          }
          catch (SQLException e) {
                UsageException errorVar = new UsageException(e.getMessage(), SP_ER_USER, SP_ER_PARAMETERERROR, e);
                ErrorMgr.addError(errorVar);
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            if (pValue instanceof TextData) {
              TextData textValue = (TextData) pValue;
              cachedRowSet.updateString(pColOrdinal, textValue.toString());
            } else if (pValue instanceof IntegerData) {
              IntegerData integerValue = (IntegerData) pValue;
              cachedRowSet.updateInt(pColOrdinal, integerValue.getIntegerValue());
            } else if (pValue instanceof DoubleData) {
              DoubleData doubleValue = (DoubleData) pValue;
              cachedRowSet.updateDouble(pColOrdinal, doubleValue.getDoubleValue());
            } else if (pValue instanceof DecimalData) {
              DecimalData value = (DecimalData) pValue;
              cachedRowSet.updateBigDecimal(pColOrdinal, value.getBigDecimal());
            } else if (pValue instanceof BooleanData) {
              BooleanData value = (BooleanData) pValue;
              cachedRowSet.updateBoolean(pColOrdinal, value.getBooleanValue());
            } else if (pValue instanceof DateTimeData) {
              DateTimeData value = (DateTimeData) pValue;
              cachedRowSet.updateDate(pColOrdinal, new Date(value.asDate().getTime()));
            } else if (pValue instanceof BinaryData) {
              BinaryData value = (BinaryData) pValue;
              cachedRowSet.updateBinaryStream(pColOrdinal, new ByteArrayInputStream(value.getValue()), value.getActualSize());
            }
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), Framework.Constants.SP_ER_USER, Framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
View Full Code Here

TOP

Related Classes of javax.sql.rowset.CachedRowSet

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.