Example usage for java.sql ResultSet getFloat

List of usage examples for java.sql ResultSet getFloat

Introduction

In this page you can find the example usage for java.sql ResultSet getFloat.

Prototype

float getFloat(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.

Usage

From source file:com.engine.QuoteServletData.java

/**
 *
 * @param id - zTblOpp4.ID/* w  w  w.  jav  a 2s  .  c o m*/
 */
public QuoteServletData(String id) {
    items = new ArrayList<>();
    java.sql.Connection con = null;
    java.sql.PreparedStatement stmt = null;
    java.sql.ResultSet rs = null;
    try {
        con = ControlPanelPool.getInstance().getConnection();
        /*
        stmt = con.prepareStatement("SELECT * FROM zTblOpp4 WHERE z3ID = ?");
        stmt.setString(1, id);
        rs = stmt.executeQuery();
        originZip = "";
        country = "";
        while (rs.next()) {
        originZip = rs.getString("ZIP");
        country = rs.getString("COUNTRY");
        }
        productClass = "";
         */
        System.out.println("tblOppMngr4.z4ID = " + id);
        String z3Id = "";
        String z1Id = "";
        stmt = con.prepareStatement("SELECT * FROM tblOppMngr4 WHERE z4ID = ?");
        stmt.setString(1, id);
        rs = stmt.executeQuery();
        while (rs.next()) {
            z3Id = rs.getString("z3ID");
            z1Id = rs.getString("z1ID");
            originZip = rs.getString("SFZIP");
        }
        stmt = con.prepareStatement("SELECT * FROM tblOppMngr1 WHERE z1ID = ?");
        stmt.setString(1, z1Id);
        rs = stmt.executeQuery();
        while (rs.next()) {
            destinationZip = rs.getString("STZIP");
        }
        //https://www.zipcodeapi.com/rest/NGaSQLHFvsGMP1rbcB7RJbb67rX5JAqxgAq6m7LSAsEpt5BFGIxqUIw29u7S4xqk/distance.json/10801/08854/mile
        //get the warehouse and compare the zip codes and find out which one is the closest and use that 
        //for generating the quote that is crossdock
        //while the regular quote should be generated as well
        //the warehouse should also be checked to be able to handle the hazmat material if the matrial is hazmat 
        //when it is a crossdock the notify prior to delivery fee should be added
        //if it is a direct order do not notify prior to delivery
        stmt = con.prepareStatement("SELECT * FROM tblOppMngr3 WHERE z1ID = ?");
        stmt.setString(1, z1Id);
        rs = stmt.executeQuery();
        while (rs.next()) {
            if (rs.getString("HZMT") != null && !rs.getString("HZMT").isEmpty()) {
                if (rs.getString("HZMT").startsWith("Haz")) {
                    productClass = "85";
                }
                if (rs.getString("HZMT").startsWith("Non")) {
                    productClass = "65";
                }
            } else {
                productClass = "65";
            }
            productUm = rs.getString("UNITMEASURE") == null ? "LB" : rs.getString("UNITMEASURE");
            productWeight = (rs.getDouble("QUANT") == 0 ? 1 : rs.getDouble("QUANT"))
                    * (rs.getDouble("MEASURE") == 0 ? 1 : rs.getDouble("MEASURE"));
            Item it = new Item(rs.getString("ID"), productClass, String.valueOf(productWeight));
            items.add(it);
        }
        stmt = con.prepareStatement("SELECT * FROM tblUMMultiplier WHERE UM = ?");
        stmt.setString(1, productUm);
        rs = stmt.executeQuery();
        while (rs.next()) {
            productWeight = productWeight * rs.getFloat("LBmultplier");
        }
        stmt = con.prepareStatement("SELECT * FROM tblWarehouse WHERE Active = 1");
        ConcurrentMap<String, String> warehouseZip = new ConcurrentHashMap<>();
        rs = stmt.executeQuery();

        while (rs.next()) {
            if (rs.getString("WHZIP") != null) {
                warehouseZip.put(rs.getString("WHZIP"), "");
            }
        }
        for (String key : warehouseZip.keySet()) {
            if (key.matches("[0-9]+")) {
                URL url = new URL("http://10.1.1.58:8080/zip/distance?zip1=" + originZip + "&zip2=" + key);
                URLConnection conn = url.openConnection();
                BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                String inputLine;
                while ((inputLine = br.readLine()) != null) {
                    warehouseZip.put(key, inputLine.substring(1, inputLine.length() - 1));
                }
                br.close();
            }
        }
        double min = 10000.0;
        for (String key : warehouseZip.keySet()) {
            if (!warehouseZip.get(key).isEmpty() && warehouseZip.get(key) != null) {
                if (Double.valueOf(warehouseZip.get(key)) < min) {
                    min = Double.valueOf(warehouseZip.get(key));
                    whZip = key;
                }
            }
        }
        con.close();
    } catch (IOException | SQLException | PropertyVetoException ex) {
        Logger.getLogger(QuoteServletData.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        DbUtils.closeQuietly(con, stmt, rs);
    }
}

From source file:org.exoplatform.social.core.mysql.storage.ActivityMysqlStorageImpl.java

private void fillActivityFromResultSet(ResultSet rs, ExoSocialActivity activity) throws SQLException {

    activity.setId(rs.getString("_id"));
    activity.setTitle(rs.getString("title"));
    activity.setTitleId(rs.getString("titleId"));
    activity.setBody(rs.getString("body"));
    activity.setBodyId(rs.getString("bodyId"));
    activity.setUserId(rs.getString("posterId"));
    activity.setPostedTime(rs.getLong("postedTime"));
    activity.setUpdated(rs.getLong("lastUpdated"));
    //activity.setType(activityEntity.getType());
    activity.setAppId(rs.getString("appId"));
    activity.setExternalId(rs.getString("externalId"));
    //activity.setUrl(activityEntity.getUrl());
    activity.setPriority(rs.getFloat("priority"));
    if (rs.wasNull()) {
        activity.setPriority(null);/*w  w  w  . j a  va  2 s . co m*/
    }
    activity.setPosterId(rs.getString("posterId"));
    //
    byte[] st = (byte[]) rs.getObject("templateParams");
    try {
        ByteArrayInputStream baip = new ByteArrayInputStream(st);
        ObjectInputStream ois = new ObjectInputStream(baip);
        activity.setTemplateParams((Map<String, String>) ois.readObject());
    } catch (Exception e) {
        LOG.debug("Failed to get templateParams of activity from database");
    }

    String[] commentIds = StringUtils.split(rs.getString("commentIds"), ",");
    activity.setReplyToId(commentIds);

    String lks = rs.getString("likers");
    String[] likes = StringUtils.split(lks, ",");
    if (likes != null) {
        activity.setLikeIdentityIds(likes);
    }

    String[] mentioners = StringUtils.split(rs.getString("mentioners"), ",");
    if (mentioners != null) {
        activity.setMentionedIds(mentioners);
    }

    String[] commenters = StringUtils.split(rs.getString("commenters"), ",");
    if (commenters != null) {
        activity.setCommentedIds(commenters);
    }

    //mentioners and commenters are moved to StreamItem

    //
    activity.isLocked(rs.getBoolean("lockable"));
    activity.isHidden(rs.getBoolean("hidable"));
    activity.setType(rs.getString("activityType"));

    ActivityStream stream = new ActivityStreamImpl();
    String ownerIdentityId = rs.getString("ownerIdentityId");
    Identity owner = identityStorage.findIdentityById(ownerIdentityId);
    stream.setType(owner.getProviderId());
    stream.setPrettyId(owner.getRemoteId());
    stream.setId(owner.getId());

    //
    activity.setActivityStream(stream);
    activity.setStreamOwner(owner.getRemoteId());
    activity.setStreamId(ownerIdentityId);
}

From source file:org.cloudgraph.rdb.service.RDBDataConverter.java

private Object convertFrom(ResultSet rs, int columnIndex, int sourceType, Property property)
        throws SQLException {
    Object result = null;/*w  w  w.ja va2 s.  c o  m*/
    if (!property.getType().isDataType())
        throw new IllegalArgumentException("expected data type property, not " + property.toString());
    DataType targetDataType = DataType.valueOf(property.getType().getName());
    switch (targetDataType) {
    case String:
    case URI:
    case Month:
    case MonthDay:
    case Day:
    case Time:
    case Year:
    case YearMonth:
    case YearMonthDay:
    case Duration:
        result = rs.getString(columnIndex);
        break;
    case Date:
        java.sql.Timestamp ts = rs.getTimestamp(columnIndex);
        if (ts != null)
            result = new java.util.Date(ts.getTime());
        break;
    case DateTime:
        ts = rs.getTimestamp(columnIndex);
        if (ts != null) {
            // format DateTime String for SDO
            java.util.Date date = new java.util.Date(ts.getTime());
            result = DataConverter.INSTANCE.getDateTimeFormat().format(date);
        }
        break;
    case Decimal:
        result = rs.getBigDecimal(columnIndex);
        break;
    case Bytes:
        if (sourceType != Types.BLOB) {
            result = rs.getBytes(columnIndex);
        } else if (sourceType == Types.BLOB) {
            Blob blob = rs.getBlob(columnIndex);
            if (blob != null) {
                long blobLen = blob.length(); // for debugging
                // Note: blob.getBytes(columnIndex, blob.length()); is
                // somehow truncating the array
                // by something like 14 bytes (?!!) even though
                // blob.length() returns the expected length
                // using getBinaryStream which is preferred anyway
                InputStream is = blob.getBinaryStream();
                try {
                    byte[] bytes = IOUtils.toByteArray(is);
                    long len = bytes.length; // for debugging
                    result = bytes;
                } catch (IOException e) {
                    throw new RDBServiceException(e);
                } finally {
                    try {
                        is.close();
                    } catch (IOException e) {
                        log.error(e.getMessage(), e);
                    }
                }
            }
        }
        break;
    case Byte:
        result = rs.getByte(columnIndex);
        break;
    case Boolean:
        result = rs.getBoolean(columnIndex);
        break;
    case Character:
        result = rs.getInt(columnIndex);
        break;
    case Double:
        result = rs.getDouble(columnIndex);
        break;
    case Float:
        result = rs.getFloat(columnIndex);
        break;
    case Int:
        result = rs.getInt(columnIndex);
        break;
    case Integer:
        result = new BigInteger(rs.getString(columnIndex));
        break;
    case Long:
        result = rs.getLong(columnIndex);
        break;
    case Short:
        result = rs.getShort(columnIndex);
        break;
    case Strings:
        String value = rs.getString(columnIndex);
        if (value != null) {
            String[] values = value.split("\\s");
            List<String> list = new ArrayList<String>(values.length);
            for (int i = 0; i < values.length; i++)
                list.add(values[i]); // what no Java 5 sugar for this ??
            result = list;
        }
        break;
    case Object:
    default:
        result = rs.getObject(columnIndex);
        break;
    }
    return result;
}

From source file:oscar.oscarRx.data.RxPrescriptionData.java

public Favorite getFavorite(int favoriteId) {
    Favorite favorite = null;/*from  w  w w  .  j a v a2 s.c o  m*/

    try {

        ResultSet rs;

        rs = DBHandler.GetSQL("SELECT * FROM favorites WHERE favoriteid = " + favoriteId);

        if (rs.next()) {
            favorite = new Favorite(rs.getInt("favoriteid"), oscar.Misc.getString(rs, "provider_no"),
                    oscar.Misc.getString(rs, "favoritename"), oscar.Misc.getString(rs, "BN"),
                    rs.getInt("GCN_SEQNO"), oscar.Misc.getString(rs, "customName"), rs.getFloat("takemin"),
                    rs.getFloat("takemax"), oscar.Misc.getString(rs, "freqcode"),
                    oscar.Misc.getString(rs, "duration"), oscar.Misc.getString(rs, "durunit"),
                    oscar.Misc.getString(rs, "quantity"), rs.getInt("repeat"), rs.getInt("nosubs"),
                    rs.getInt("prn"), oscar.Misc.getString(rs, "special"), oscar.Misc.getString(rs, "GN"),
                    oscar.Misc.getString(rs, "ATC"), oscar.Misc.getString(rs, "regional_identifier"),
                    oscar.Misc.getString(rs, "unit"), oscar.Misc.getString(rs, "unitName"),
                    oscar.Misc.getString(rs, "method"), oscar.Misc.getString(rs, "route"),
                    oscar.Misc.getString(rs, "drug_form"), rs.getBoolean("custom_instructions"),
                    oscar.Misc.getString(rs, "dosage"));
        }

        rs.close();

    } catch (SQLException e) {
        logger.error("unexpected error", e);
    } finally {
        DbConnectionFilter.releaseThreadLocalDbConnection();
    }

    return favorite;
}

From source file:org.etudes.component.app.jforum.dao.generic.GradeDaoGeneric.java

protected List<Grade> getGrades(StringBuilder sql, Object[] fields) {
    final List<Grade> grades = new ArrayList<Grade>();

    if (sql != null && fields != null) {
        this.sqlService.dbRead(sql.toString(), fields, new SqlReader() {
            public Object readSqlResultRecord(ResultSet result) {
                try {
                    Grade grade = new GradeImpl();
                    ((GradeImpl) grade).setId(result.getInt("grade_id"));
                    grade.setContext(result.getString("context"));
                    grade.setType(result.getInt("grade_type"));
                    grade.setForumId(result.getInt("forum_id"));
                    grade.setTopicId(result.getInt("topic_id"));
                    grade.setPoints(result.getFloat("points"));
                    grade.setAddToGradeBook(result.getInt("add_to_gradebook") == 1);
                    grade.setCategoryId(result.getInt("categories_id"));
                    grade.setMinimumPostsRequired(result.getInt("min_posts_required") == 1);
                    grade.setMinimumPosts(result.getInt("min_posts"));
                    ((GradeImpl) grade).setItemOpenDate(result.getTimestamp("open_date"));
                    grades.add(grade);//ww  w  .  j a  va 2  s  .c  om

                    return null;
                } catch (SQLException e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn("getGrade: " + e, e);
                    }
                    return null;
                }
            }
        });
    }

    return grades;
}

From source file:org.etudes.component.app.jforum.dao.generic.GradeDaoGeneric.java

/**
 * Gets the grade//  w  ww.j  a va 2  s . c o m
 * 
 * @param sql      SQL Query
 * 
 * @param fields   Query parameters
 * 
 * @return      The grade if existing else null
 */
protected Grade getGrade(StringBuilder sql, Object[] fields) {
    Grade grade = null;

    final List<Grade> grades = new ArrayList<Grade>();

    if (sql != null && fields != null) {
        this.sqlService.dbRead(sql.toString(), fields, new SqlReader() {
            public Object readSqlResultRecord(ResultSet result) {
                try {
                    Grade grade = new GradeImpl();
                    ((GradeImpl) grade).setId(result.getInt("grade_id"));
                    grade.setContext(result.getString("context"));
                    grade.setType(result.getInt("grade_type"));
                    grade.setForumId(result.getInt("forum_id"));
                    grade.setTopicId(result.getInt("topic_id"));
                    grade.setPoints(result.getFloat("points"));
                    grade.setAddToGradeBook(result.getInt("add_to_gradebook") == 1);
                    grade.setCategoryId(result.getInt("categories_id"));
                    grade.setMinimumPostsRequired(result.getInt("min_posts_required") == 1);
                    grade.setMinimumPosts(result.getInt("min_posts"));
                    ((GradeImpl) grade).setItemOpenDate(result.getTimestamp("open_date"));
                    grades.add(grade);

                    return null;
                } catch (SQLException e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn("getGrade: " + e, e);
                    }
                    return null;
                }
            }
        });
    }

    if (grades.size() == 1) {
        grade = grades.get(0);
    }
    return grade;
}

From source file:org.etudes.component.app.jforum.dao.generic.GradeDaoGeneric.java

/**
 * {@inheritDoc}/*  w w  w  . java  2  s. c  o  m*/
 */
public List<Grade> selectTopicGradesByForumId(int forumId) {
    StringBuilder sql = null;
    Object[] fields = null;
    int i = 0;

    sql = new StringBuilder();
    //sql.append("SELECT grade_id, context, grade_type, forum_id, topic_id, points, add_to_gradebook, categories_id, min_posts, min_posts_required ");
    //sql.append("FROM jforum_grade WHERE forum_id = ? and grade_type = ?");
    sql.append(
            "SELECT g.grade_id, context, grade_type, forum_id, topic_id, points, add_to_gradebook, categories_id, min_posts, min_posts_required, s.open_date ");
    sql.append(
            "FROM jforum_grade g LEFT OUTER JOIN jforum_schedule_grades_gradebook s ON g.grade_id = s.grade_id ");
    sql.append("WHERE forum_id = ? and grade_type = ?");

    fields = new Object[2];
    fields[i++] = forumId;
    fields[i++] = Grade.GradeType.TOPIC.getType();

    final List<Grade> grades = new ArrayList<Grade>();

    if (sql != null && fields != null) {
        this.sqlService.dbRead(sql.toString(), fields, new SqlReader() {
            public Object readSqlResultRecord(ResultSet result) {
                try {
                    Grade grade = new GradeImpl();
                    ((GradeImpl) grade).setId(result.getInt("grade_id"));
                    grade.setContext(result.getString("context"));
                    grade.setType(result.getInt("grade_type"));
                    grade.setForumId(result.getInt("forum_id"));
                    grade.setTopicId(result.getInt("topic_id"));
                    grade.setPoints(result.getFloat("points"));
                    grade.setAddToGradeBook(result.getInt("add_to_gradebook") == 1);
                    grade.setCategoryId(result.getInt("categories_id"));
                    grade.setMinimumPostsRequired(result.getInt("min_posts_required") == 1);
                    grade.setMinimumPosts(result.getInt("min_posts"));
                    ((GradeImpl) grade).setItemOpenDate(result.getTimestamp("open_date"));
                    grades.add(grade);

                    return null;
                } catch (SQLException e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn("selectTopicGradesByForumId: " + e, e);
                    }
                    return null;
                }
            }
        });
    }

    return grades;
}

From source file:org.etudes.component.app.jforum.dao.generic.GradeDaoGeneric.java

/**
 * {@inheritDoc}/*from   w  ww  .j a  v a 2 s . c  o m*/
 */
public List<Grade> selectForumTopicGradesByCategoryId(int categoryId) {
    StringBuilder sql = null;
    Object[] fields = null;
    int i = 0;

    sql = new StringBuilder();
    //sql.append("SELECT g.grade_id, g.context, g.grade_type, g.forum_id, g.topic_id, g.points, g.add_to_gradebook, g.categories_id, g.min_posts, g.min_posts_required ");
    //sql.append("FROM jforum_grade g, jforum_forums f WHERE g.forum_id = f.forum_id AND  f.categories_id = ? AND (f.forum_grade_type = ? OR f.forum_grade_type = ?)");
    sql.append(
            "SELECT g.grade_id, g.context, g.grade_type, g.forum_id, g.topic_id, g.points, g.add_to_gradebook, g.categories_id, g.min_posts, g.min_posts_required, s.open_date ");
    sql.append(
            "FROM jforum_forums f, jforum_grade g LEFT OUTER JOIN jforum_schedule_grades_gradebook s ON g.grade_id = s.grade_id ");
    sql.append(
            "WHERE g.forum_id = f.forum_id AND  f.categories_id = ? AND (f.forum_grade_type = ? OR f.forum_grade_type = ?)");

    fields = new Object[3];
    fields[i++] = categoryId;
    fields[i++] = Grade.GradeType.FORUM.getType();
    fields[i++] = Grade.GradeType.TOPIC.getType();

    final List<Grade> grades = new ArrayList<Grade>();

    if (sql != null && fields != null) {
        this.sqlService.dbRead(sql.toString(), fields, new SqlReader() {
            public Object readSqlResultRecord(ResultSet result) {
                try {
                    Grade grade = new GradeImpl();
                    ((GradeImpl) grade).setId(result.getInt("grade_id"));
                    grade.setContext(result.getString("context"));
                    grade.setType(result.getInt("grade_type"));
                    grade.setForumId(result.getInt("forum_id"));
                    grade.setTopicId(result.getInt("topic_id"));
                    grade.setPoints(result.getFloat("points"));
                    grade.setAddToGradeBook(result.getInt("add_to_gradebook") == 1);
                    grade.setCategoryId(result.getInt("categories_id"));
                    grade.setMinimumPostsRequired(result.getInt("min_posts_required") == 1);
                    grade.setMinimumPosts(result.getInt("min_posts"));
                    ((GradeImpl) grade).setItemOpenDate(result.getTimestamp("open_date"));
                    grades.add(grade);

                    return null;
                } catch (SQLException e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn("selectForumTopicGradesByCategoryId: " + e, e);
                    }
                    return null;
                }
            }
        });
    }

    return grades;
}

From source file:oscar.oscarRx.data.RxPrescriptionData.java

public Favorite[] getFavorites(String providerNo) {
    Favorite[] arr = {};/*from w  w  w . jav  a  2s  .  c  om*/
    LinkedList lst = new LinkedList();

    try {

        ResultSet rs;
        Favorite favorite;

        rs = DBHandler.GetSQL(
                "SELECT * FROM favorites WHERE provider_no = '" + providerNo + "' ORDER BY favoritename");

        while (rs.next()) {
            favorite = new Favorite(rs.getInt("favoriteid"), oscar.Misc.getString(rs, "provider_no"),
                    oscar.Misc.getString(rs, "favoritename"), oscar.Misc.getString(rs, "BN"),
                    rs.getInt("GCN_SEQNO"), oscar.Misc.getString(rs, "customName"), rs.getFloat("takemin"),
                    rs.getFloat("takemax"), oscar.Misc.getString(rs, "freqcode"),
                    oscar.Misc.getString(rs, "duration"), oscar.Misc.getString(rs, "durunit"),
                    oscar.Misc.getString(rs, "quantity"), rs.getInt("repeat"), rs.getInt("nosubs"),
                    rs.getInt("prn"), oscar.Misc.getString(rs, "special"), oscar.Misc.getString(rs, "GN"),
                    oscar.Misc.getString(rs, "ATC"), oscar.Misc.getString(rs, "regional_identifier"),
                    oscar.Misc.getString(rs, "unit"), oscar.Misc.getString(rs, "unitName"),
                    oscar.Misc.getString(rs, "method"), oscar.Misc.getString(rs, "route"),
                    oscar.Misc.getString(rs, "drug_form"), rs.getBoolean("custom_instructions"),
                    oscar.Misc.getString(rs, "dosage"));

            lst.add(favorite);
        }

        rs.close();

        arr = (Favorite[]) lst.toArray(arr);

    } catch (SQLException e) {
        logger.error("unexpected error", e);
    } finally {
        DbConnectionFilter.releaseThreadLocalDbConnection();
    }

    return arr;
}

From source file:it.greenvulcano.gvesb.datahandling.dbo.utils.StandardRowSetBuilder.java

public int build(Document doc, String id, ResultSet rs, Set<Integer> keyField,
        Map<String, FieldFormatter> fieldNameToFormatter, Map<String, FieldFormatter> fieldIdToFormatter)
        throws Exception {
    if (rs == null) {
        return 0;
    }//from   w  ww.  jav  a2s. c  o  m
    int rowCounter = 0;
    Element docRoot = doc.getDocumentElement();
    ResultSetMetaData metadata = rs.getMetaData();
    FieldFormatter[] fFormatters = buildFormatterArray(metadata, fieldNameToFormatter, fieldIdToFormatter);

    boolean noKey = ((keyField == null) || keyField.isEmpty());

    //boolean isNull = false;
    Element data = null;
    Element row = null;
    Element col = null;
    Text text = null;
    String textVal = null;
    String precKey = null;
    String colKey = null;
    Map<String, String> keyAttr = new HashMap<String, String>();
    while (rs.next()) {
        if (rowCounter % 10 == 0) {
            ThreadUtils.checkInterrupted(getClass().getSimpleName(), name, logger);
        }
        row = parser.createElement(doc, AbstractDBO.ROW_NAME);

        parser.setAttribute(row, AbstractDBO.ID_NAME, id);
        for (int j = 1; j <= metadata.getColumnCount(); j++) {
            FieldFormatter fF = fFormatters[j];

            //isNull = false;
            col = parser.createElement(doc, AbstractDBO.COL_NAME);
            switch (metadata.getColumnType(j)) {
            case Types.DATE: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.DATE_TYPE);
                java.sql.Date dateVal = rs.getDate(j);
                textVal = processDateTime(col, fF, dateVal, AbstractDBO.DEFAULT_DATE_FORMAT);
            }
                break;
            case Types.TIME: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.TIME_TYPE);
                java.sql.Time dateVal = rs.getTime(j);
                textVal = processDateTime(col, fF, dateVal, AbstractDBO.DEFAULT_TIME_FORMAT);
            }
                break;
            case Types.TIMESTAMP: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.TIMESTAMP_TYPE);
                Timestamp dateVal = rs.getTimestamp(j);
                textVal = processDateTime(col, fF, dateVal, AbstractDBO.DEFAULT_DATE_FORMAT);
            }
                break;
            case Types.DOUBLE: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.FLOAT_TYPE);
                double numVal = rs.getDouble(j);
                textVal = processDouble(col, fF, numVal);
            }
                break;
            case Types.FLOAT:
            case Types.REAL: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.FLOAT_TYPE);
                float numVal = rs.getFloat(j);
                textVal = processDouble(col, fF, numVal);
            }
                break;
            case Types.BIGINT: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.BIGINT_TYPE);
                long numVal = rs.getLong(j);
                parser.setAttribute(col, AbstractDBO.NULL_NAME, "false");
                textVal = String.valueOf(numVal);
            }
                break;
            case Types.INTEGER: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.INTEGER_TYPE);
                int numVal = rs.getInt(j);
                parser.setAttribute(col, AbstractDBO.NULL_NAME, "false");
                textVal = String.valueOf(numVal);
            }
                break;
            case Types.SMALLINT:
            case Types.TINYINT: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.SMALLINT_TYPE);
                short numVal = rs.getShort(j);
                parser.setAttribute(col, AbstractDBO.NULL_NAME, "false");
                textVal = String.valueOf(numVal);
            }
                break;
            case Types.NUMERIC:
            case Types.DECIMAL: {
                BigDecimal bigdecimal = rs.getBigDecimal(j);
                boolean isNull = bigdecimal == null;
                parser.setAttribute(col, AbstractDBO.NULL_NAME, String.valueOf(isNull));
                if (isNull) {
                    if (metadata.getScale(j) > 0) {
                        parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.DECIMAL_TYPE);
                    } else {
                        parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.NUMERIC_TYPE);
                    }
                    textVal = "";
                } else {
                    if (fF != null) {
                        parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.DECIMAL_TYPE);
                        parser.setAttribute(col, AbstractDBO.FORMAT_NAME, fF.getNumberFormat());
                        parser.setAttribute(col, AbstractDBO.GRP_SEPARATOR_NAME, fF.getGroupSeparator());
                        parser.setAttribute(col, AbstractDBO.DEC_SEPARATOR_NAME, fF.getDecSeparator());
                        textVal = fF.formatNumber(bigdecimal);
                    } else if (metadata.getScale(j) > 0) {
                        parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.DECIMAL_TYPE);
                        parser.setAttribute(col, AbstractDBO.FORMAT_NAME, numberFormat);
                        parser.setAttribute(col, AbstractDBO.GRP_SEPARATOR_NAME, groupSeparator);
                        parser.setAttribute(col, AbstractDBO.DEC_SEPARATOR_NAME, decSeparator);
                        textVal = numberFormatter.format(bigdecimal);
                    } else {
                        parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.NUMERIC_TYPE);
                        textVal = bigdecimal.toString();
                    }
                }
            }
                break;
            case Types.BOOLEAN: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.BOOLEAN_TYPE);
                boolean bVal = rs.getBoolean(j);
                parser.setAttribute(col, AbstractDBO.NULL_NAME, "false");
                textVal = String.valueOf(bVal);
            }
                break;
            case Types.SQLXML: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.XML_TYPE);
                SQLXML xml = rs.getSQLXML(j);
                boolean isNull = xml == null;
                parser.setAttribute(col, AbstractDBO.NULL_NAME, String.valueOf(isNull));
                if (isNull) {
                    textVal = "";
                } else {
                    textVal = xml.getString();
                }
            }
                break;
            case Types.NCHAR:
            case Types.NVARCHAR: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.NSTRING_TYPE);
                textVal = rs.getNString(j);
                if (textVal == null) {
                    textVal = "";
                }
            }
                break;
            case Types.CHAR:
            case Types.VARCHAR: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.STRING_TYPE);
                textVal = rs.getString(j);
                boolean isNull = textVal == null;
                parser.setAttribute(col, AbstractDBO.NULL_NAME, String.valueOf(isNull));
                if (isNull) {
                    textVal = "";
                }
            }
                break;
            case Types.NCLOB: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.LONG_NSTRING_TYPE);
                NClob clob = rs.getNClob(j);
                if (clob != null) {
                    Reader is = clob.getCharacterStream();
                    StringWriter str = new StringWriter();

                    IOUtils.copy(is, str);
                    is.close();
                    textVal = str.toString();
                } else {
                    textVal = "";
                }
            }
                break;
            case Types.CLOB: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.LONG_STRING_TYPE);
                Clob clob = rs.getClob(j);
                if (clob != null) {
                    Reader is = clob.getCharacterStream();
                    StringWriter str = new StringWriter();

                    IOUtils.copy(is, str);
                    is.close();
                    textVal = str.toString();
                } else {
                    textVal = "";
                }
            }
                break;
            case Types.BLOB: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.BASE64_TYPE);
                Blob blob = rs.getBlob(j);
                boolean isNull = blob == null;
                parser.setAttribute(col, AbstractDBO.NULL_NAME, String.valueOf(isNull));
                if (isNull) {
                    textVal = "";
                } else {
                    InputStream is = blob.getBinaryStream();
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    IOUtils.copy(is, baos);
                    is.close();
                    try {
                        byte[] buffer = Arrays.copyOf(baos.toByteArray(), (int) blob.length());
                        textVal = Base64.getEncoder().encodeToString(buffer);
                    } catch (SQLFeatureNotSupportedException exc) {
                        textVal = Base64.getEncoder().encodeToString(baos.toByteArray());
                    }
                }
            }
                break;
            default: {
                parser.setAttribute(col, AbstractDBO.TYPE_NAME, AbstractDBO.DEFAULT_TYPE);
                textVal = rs.getString(j);
                boolean isNull = textVal == null;
                parser.setAttribute(col, AbstractDBO.NULL_NAME, String.valueOf(isNull));
                if (isNull) {
                    textVal = "";
                }
            }
            }
            if (textVal != null) {
                text = doc.createTextNode(textVal);
                col.appendChild(text);
            }
            if (!noKey && keyField.contains(new Integer(j))) {
                if (textVal != null) {
                    if (colKey == null) {
                        colKey = textVal;
                    } else {
                        colKey += "##" + textVal;
                    }
                    keyAttr.put("key_" + j, textVal);
                }
            } else {
                row.appendChild(col);
            }
        }
        if (noKey) {
            if (data == null) {
                data = parser.createElement(doc, AbstractDBO.DATA_NAME);
                parser.setAttribute(data, AbstractDBO.ID_NAME, id);
            }
        } else if ((colKey != null) && !colKey.equals(precKey)) {
            if (data != null) {
                docRoot.appendChild(data);
            }
            data = parser.createElement(doc, AbstractDBO.DATA_NAME);
            parser.setAttribute(data, AbstractDBO.ID_NAME, id);
            for (Entry<String, String> keyAttrEntry : keyAttr.entrySet()) {
                parser.setAttribute(data, keyAttrEntry.getKey(), keyAttrEntry.getValue());
            }
            keyAttr.clear();
            precKey = colKey;
        }
        colKey = null;
        data.appendChild(row);
        rowCounter++;
    }
    if (data != null) {
        docRoot.appendChild(data);
    }

    return rowCounter;
}