Package com.sun.rowset

Examples of com.sun.rowset.CachedRowSetImpl


      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        try {
          pg = Functions.definePage(TotalRecords, 1, 0);
          RoadLocation[] rl;

          if (pg.getRecordsInitial() <= TotalRecords) {
            rl = new RoadLocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];

            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                // classe road
                rl[iCount] = new RoadLocation();
                rl[iCount].setRoad(new Road());
                rl[iCount].getRoad().setName(rs1.getString("ENDERECO"));
                rl[iCount].getRoad().setRoadNumber(rs1.getString("NUMERO"));

                rl[iCount].getRoad().setCity(new City());
                rl[iCount].getRoad().getCity().setName(rs1.getString("MUNICIPIO"));
                rl[iCount].getRoad().getCity().setState(rs1.getString("UF"));
                rl[iCount].getRoad().setZip(rs1.getString("CEP"));

                rl[iCount].setRoadDetail(new RoadDetail());
                rl[iCount].getRoadDetail().setAlterName(rs1.getString("ENDERECOALT"));
                rl[iCount].getRoadDetail().setComplement(rs1.getString("COMPLEMENTO"));
                rl[iCount].getRoadDetail().setDirection(rs1.getString("SENTIDO"));
                rl[iCount].getRoadDetail().setDistrict(rs1.getString("BAIRRO"));

                iCount++;
              }
            }
            ri.setRecordCount((int) pg.getRecordCount());
            ri.setPageCount(pg.getPageCount());
          } else {
            rl = new RoadLocation[0];
          }

          ri.setRoadLocation(rl);
        } catch (Exception ex) {
          throw (new Exception("Registro n�o encontrado."));
        }
      } else {
        RoadLocation[] rl = new RoadLocation[0];
        ri.setRoadLocation(rl);
      }

      con.close();
      rs1.close();
      crs.close();
      cst.close();
    } catch (Exception ex) {
      throw (new Exception(ex.getMessage()));
    }
View Full Code Here


      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        try {
          pg = Functions.definePage(TotalRecords, 1, 0);
          // RoadLocation[] rl;

          if (pg.getRecordsInitial() <= TotalRecords) {
            // rl = new RoadLocation[(pg.getRecordsFinal() -
            // pg.getRecordsInitial()) + 1];

            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                pt.setX(Double.parseDouble(rs1.getString("X")));
                pt.setY(Double.parseDouble(rs1.getString("Y")));

                iCount++;
              }
            }
          }
        } catch (Exception ex) {
          throw (new Exception("Registro n�o encontrado."));
        }
      }

      con.close();
      rs1.close();
      crs.close();
      cst.close();
    } catch (Exception ex) {
      throw (new Exception(ex.getMessage()));
    }
View Full Code Here

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        pg = Functions.definePage(TotalRecords, resultRange.getRecordsPerPage(), resultRange.getPageIndex());

        POILocation[] poil;

        if (pg.getRecordsInitial() <= TotalRecords) {
          poil = new POILocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];

          for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
            if (rs1.absolute(intI)) {
              poil[iCount] = new POILocation();
              poil[iCount].setName(rs1.getString("NOME"));
              poil[iCount].setDistrict(rs1.getString("BAIRRO"));
              poil[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

              poil[iCount].setPoint(new Point());
              poil[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
              poil[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));

              poil[iCount].setCity(new City());
              poil[iCount].setCity(city);
              poil[iCount].setDataSource(city.getState().toUpperCase());

              iCount++;
            }
          }
        } else {
          poil = new POILocation[0];
        }

        poii.setRecordCount((int) pg.getRecordCount());
        poii.setPageCount(pg.getPageCount());
        poii.setPoiLocations(poil);
      } else {
        poii.setPoiLocations(new POILocation[0]);
      }

      con.close();
      rs1.close();
      crs.close();
      cst.close();
    } catch (Exception e) {
      throw e;
    }
View Full Code Here

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      AddressLocation[] al;

      if (TotalRecords > 0) {
        pg = Functions.definePage(TotalRecords, ao.getResultRange().getRecordsPerPage(), ao.getResultRange().getPageIndex());

        if (country.toLowerCase().equals("brasil")) {
          Statement stEstado = con.createStatement();

          crs.next();
          String sql = " select FNCCAMELCASE(estado) estado from TB_CIDADES where geocode = '" + crs.getString("TABELA") + "' ";
          ResultSet rrEstado = stEstado.executeQuery(sql.toUpperCase());

          CachedRowSetImpl crsEstado = new CachedRowSetImpl();
          crsEstado.populate(rrEstado);

          if (crsEstado.size() != 0) {
            crsEstado.next();
            state = crsEstado.getString("ESTADO");
          }

          if (pg.getRecordsInitial() <= TotalRecords) {
            al = new AddressLocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];
            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                al[iCount] = new AddressLocation();
                al[iCount].setZipL(rs1.getString("CEPL"));
                al[iCount].setZipR(rs1.getString("CEPR"));
                al[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

                // classe address
                al[iCount].getAddress().setStreet(rs1.getString("LOGRAC"));
                al[iCount].getAddress().setDistrict(rs1.getString("BAIRRO"));
                al[iCount].getAddress().getCity().setName(rs1.getString("MUNICIPIO"));
                al[iCount].getAddress().getCity().setCountry(country);
                // al[iCount].getAddress().setZone(rs1.getString("REGIAO"));

                if (!country.toLowerCase().equals("brasil"))
                  al[iCount].getAddress().getCity().setState(state);
                else
                  al[iCount].getAddress().getCity().setState(rs1.getString("TABELA").substring(0, 2).toUpperCase());

                if (!al[iCount].getZipL().equals(""))
                  al[iCount].getAddress().setZip(al[iCount].getZipL());
                if (!al[iCount].getZipR().equals(""))
                  al[iCount].getAddress().setZip(al[iCount].getZipR());

                al[iCount].getAddress().setHouseNumber(rs1.getString("MEDIA"));

                try {
                  al[iCount].setPoint(Functions.getGeocodeSQL(rs1.getInt("L_F_ADD"), rs1.getInt("L_T_ADD"), rs1.getInt("R_F_ADD"),
                      rs1.getInt("R_T_ADD"), al[iCount].getAddress().getHouseNumber(), rs1.getString("COORDS")));
                } catch (Exception ex) {
                  al[iCount].getPoint().setX(0.0);
                  al[iCount].getPoint().setY(0.0);
                }

                iCount++;
              }

            }

            ai.setRecordCount((int) pg.getRecordCount());
            ai.setPageCount(pg.getPageCount());
          } else {
            al = new AddressLocation[0];
            // throw (new
            // Exception("Endere�o n�o encontrado em nossa base de dados!"));
          }

          ai.setAddressLocation(al);
        }
      } else {
        if (address.getStreet() == "" && (!Functions.IsNullOrEmpty(address.getZip()))) {
          String cmd = " select CEP, CORREIO_ENDERECO AS ENDERECO, CORREIO_MUNICIPIO AS CIDADE, CORREIO_UF AS ESTADO, "
              + "  COALESCE(X,0) as X, COALESCE(Y,0) as Y, COALESCE(CORREIO_BAIRRO_INI,'') AS BAIRRO " + "  FROM TB_CEP_BRASIL "
              + " WHERE CEP = REPLACE('" + address.getZip() + "','-','') " + " AND X IS NOT NULL".toUpperCase();

          con = dataBase.getConnection(dataB);

          Statement st = con.createStatement();

          ResultSet rr = st.executeQuery(cmd);

          crs = new CachedRowSetImpl();
          crs.populate(rr);

          if (crs.size() == 0) {
            crs.next();
View Full Code Here

      Connection con = dataBase.getConnection("DADOS_CLIENTES");
     
      Statement st = con.createStatement();
      ResultSet rr = st.executeQuery("SHOW TABLES LIKE '" + tb[0].toUpperCase() + "'");
     
      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rr);
     
      nrReg = crs.size();
     
      rr.close();
      st.close();
      crs.close();
     
      // se n�o existe alguma tabela
      if (nrReg != tb.length)
        return false;
     
      // valida campos
      String[] fields;
      fields = fieldList.split(Pattern.quote("|"));
      where = "";
     
      for (i = 0; i < fields.length; i++)
        where = where + " or field = '" + fields[i] + "'";
     
      where = where.substring(4);
     
      con = dataBase.getConnection("DADOS_CLIENTES");
     
      st = con.createStatement();
     
      rr = st.executeQuery("SHOW COLUMNS FROM DADOS_CLIENTES." + tb[0].toUpperCase() + " WHERE " + where);
     
      crs = new CachedRowSetImpl();
      crs.populate(rr);
     
      nrReg = crs.size();
     
      rr.close();
      st.close();
      crs.close();
     
      if (nrReg != fields.length)
        return false;
     
      return true;
View Full Code Here

    Connection con = dataBase.getConnection("DADOS_WEBSERVICES");
    Statement st = con.createStatement();

    ResultSet rr = st.executeQuery(sql.toUpperCase());
    CachedRowSetImpl crs = new CachedRowSetImpl();

    crs.populate(rr);

    if (crs.size() == poiRoute.length)
      return true;
    else
      return false;

  }
View Full Code Here

        // connect
        Connection conn = getConnection();
        Statement st = null;
        try {
            st = conn.createStatement();
            CachedRowSetImpl crs = new CachedRowSetImpl();
            crs.populate(st.executeQuery(sql));
            return crs;
        } finally {
            st.close();
            conn.close();
        }
View Full Code Here

TOP

Related Classes of com.sun.rowset.CachedRowSetImpl

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.