从ResultSet中读出数据并转成成对应的类型，如果指定类型rs无法转换，则不转换。

2018年4月24日 11:48:32 新增支持标记为isJSON的列的处理。
@param rs
@param columnName
@return
971845
public static Object getFromRS(ResultSet rs, String columnName, Field field)
			throws SQLException{
		if(rs.getObject(columnName) == null) { // 保证null会返回null值
			return null;
		}
		
		Column column = field.getAnnotation(Column.class);
		if(column != null && column.isJSON()) { // 优先处理标记为json的列
			String valStr = rs.getString(columnName);
			if(valStr == null || valStr.trim().isEmpty()) {
				return null;
			}
			String typeName = field.getGenericType().toString();
			try {
				if(!typeName.contains("<")) {
					return OBJECT_MAPPER.readValue(valStr, field.getType());
				} else { // 处理泛型
					JavaType type = parseGenericType(OBJECT_MAPPER.getTypeFactory(), typeName);
					return OBJECT_MAPPER.readValue(valStr, type);
				}
			} catch(Exception e) {
				LOGGER.error("parse column to JSON fail, json:{}, type:{}", valStr, typeName, e);
				return valStr; // 作为string返回，交由上一级处理
			}
		}
		
		Class<?> clazz = field.getType();
		
		if(clazz == Integer.class || clazz == int.class) {
			return rs.getInt(columnName);
		}
		if(clazz == Long.class || clazz == long.class) {
			return rs.getLong(columnName);
		}
		if(clazz == Byte.class || clazz == byte.class) {
			return rs.getByte(columnName);
		}
		if(clazz == byte[].class) {
			return rs.getBytes(columnName);
		}
		if(clazz == Short.class || clazz == short.class) {
			return rs.getShort(columnName);
		}
		if(clazz == Boolean.class || clazz == boolean.class) {
			return rs.getBoolean(columnName);
		}
		if(clazz == Float.class || clazz == float.class) {
			return rs.getFloat(columnName);
		}
		if(clazz == Double.class || clazz == double.class) {
			return rs.getDouble(columnName);
		}
		if(clazz == String.class) {
			return rs.getString(columnName);
		}
		if(clazz == BigDecimal.class) {
			return rs.getBigDecimal(columnName);
		}
		if (clazz == java.sql.Date.class) {
			return rs.getDate(columnName);
		}
		if (clazz == java.sql.Time.class) {
			return rs.getDate(columnName);
		}
		if (clazz == java.sql.Timestamp.class) {
			return rs.getTimestamp(columnName);
		}
		
		return rs.getObject(columnName);
	}
765972
public List<Map<String, Object>> convertAllToMaps(ResultSet rs) throws SQLException{
		return convertAllToMaps(rs, null);
	}
1127365
public static Document getResultSetAsXML(ResultSet rs, String tableName) throws Exception {
        return getResultSetAsXML(rs, tableName, "");
    }
1203880
@Override
  public OperationHandle getColumns(SessionHandle sessionHandle,
      String catalogName, String schemaName, String tableName, String columnName)
          throws HiveSQLException {
    OperationHandle opHandle = sessionManager.getSession(sessionHandle)
        .getColumns(catalogName, schemaName, tableName, columnName);
    LOG.debug(sessionHandle + ": getColumns()");
    return opHandle;
  }
1093786
private static List<String> getColumnLabels(ResultSet result) throws SQLException {
        // 存放结果集中的列名
        List<String> listColumns = new ArrayList<String>();
        // 获取结果集元数据
        ResultSetMetaData rsmd = result.getMetaData();
        // 将字段名放入数组中
        for (int i = 0; i < rsmd.getColumnCount(); i++) {
            listColumns.add(rsmd.getColumnLabel(i + 1));
        }

        return listColumns;
    }
756559
public final Object getColumnValue(final String columnName) {
        SQLExpression sqlExpression = values[getColumnIndex(columnName)];
        if (sqlExpression instanceof SQLParameterMarkerExpression) {
            return parameters[getParameterIndex(sqlExpression)];
        } else if (sqlExpression instanceof SQLTextExpression) {
            return ((SQLTextExpression) sqlExpression).getText();
        } else {
            return ((SQLNumberExpression) sqlExpression).getNumber();
        }
    }
1204031
private static <T> Object getColumnValue(ResultSet rs, String label, int type, Type targetColumnType) throws SQLException {
		Object rawValue;
		switch (type) {
		case Types.TIMESTAMP:
			rawValue = rs.getTimestamp(label);
			break;
		case Types.TIME:
			rawValue = rs.getTime(label);
			break;
		default:
			rawValue = rs.getObject(label);
		}
		if (null == targetColumnType || Object.class == targetColumnType) {
			// 无需转换
			return rawValue;
		} else {
			// 按照返回值要求转换
			return Convert.convert(targetColumnType, rawValue);
		}
	}
446789
public Column<?> column(String columnName) {
        for (Column<?> column : columns()) {
            String name = column.name().trim();
            if (name.equalsIgnoreCase(columnName)) {
                return column;
            }
        }
        throw new IllegalStateException(String.format("Column %s does not exist in table %s", columnName, name()));
    }
563874
protected static ResultSet getColumnMetaData (Connection conn, String table, String column)
        throws SQLException
    {
        ResultSet rs = conn.getMetaData().getColumns("", "", table, column);
        while (rs.next()) {
            String tname = rs.getString("TABLE_NAME");
            String cname = rs.getString("COLUMN_NAME");
            if (tname.equals(table) && cname.equals(column)) {
                return rs;
            }
        }
        throw new SQLException("Table or Column not defined. [table=" + table +
                               ", col=" + column + "].");
    }
686278
@Override
	public E createRecord(final ResultSet rs) throws SQLException {
		try {
			if (columnLabels == null) {
				ResultSetMetaData rsmd = rs.getMetaData();
				columnCount = rsmd.getColumnCount();

				// columnLabelsは1始まりの配列で値を格納
				columnLabels = new String[columnCount + 1];
				for (int i = 1; i <= columnCount; i++) {
					columnLabels[i] = rsmd.getColumnLabel(i);
				}
			}

			E rec = constructor.newInstance();
			for (MappingColumn column : columns) {
				bindValue(rec, rs, column);
			}
			return rec;
		} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
			LOG.error("Error!!", e);
			throw new UroborosqlRuntimeException(e);
		} catch (SQLException | RuntimeException | Error e) {
			LOG.error("Error!!", e);
			throw e;
		}
	}
5805
private String[] getColumnNames(ResultSetMetaData rsmd) throws Exception {
        ArrayList<String> names = new ArrayList<String>();

        // Get result set meta data
        int numColumns = rsmd.getColumnCount();

        // Get the column names; column indices start from 1
        for (int i = 1; i < numColumns + 1; i++) {
            String columnName = rsmd.getColumnName(i);

            names.add(columnName);
        }

        return names.toArray(new String[0]);
    }
932595
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
    public static Boolean getBoolean(final ResultSet rs, final String columnName) throws SQLException
    {
        final boolean res = rs.getBoolean(columnName);
        if (rs.wasNull()) {
            return null;
        }
        else {
            return res;
        }
    }
263459
public DataColumns getDataColumn(String tableName, String columnName)
			throws SQLException {
		TableColumnKey id = new TableColumnKey(tableName, columnName);
		return queryForId(id);
	}
1215713
protected void compute(java.sql.ResultSet rs) throws SQLException {
        ResultSetMetaData rsmd;
        int numCols;
        // Zero element will be null always
        // This is to avoid any indexing problems.. 

        rsmd = rs.getMetaData();
        numCols = rsmd.getColumnCount();

        // so that we do not have to manage indexes
        // remember to subtract 1 from size of vector
        // vector indexes are valid from 1 to size-1
        while (rs.next()) {
            // process row
            QueryRow qr = new QueryRow(numCols);
            for (int i = 1; i <= numCols; i++) {
                String colVal = rs.getString(i);
                String colName = rsmd.getColumnLabel(i);
                qr.put(colName, colVal);

            } // for
            // put Hashtable reference into Vector
            rows.addElement(qr);
        } // while
        rows.trimToSize();
        //if (!isEmpty())
        //  {
        //  this.currRow=0;
        //  setCurrRowRef((QueryRow)rows.elementAt(this.currRow));
        //  }
    }
543369
@Override
    public <E> List<E> getColumnsById(String schemaName, String tableName, String pKeyColumnName, String columnName,
            Object pKeyColumnValue, Class columnJavaType)
    {
        // search using index on pkey column
        List<E> foreignKeys = new ArrayList<E>();

        Table schemaTable = tableAPI.getTable(tableName);
        Index index = schemaTable.getIndex(pKeyColumnName);
        IndexKey indexKey = index.createIndexKey();

        // StringBuilder indexNamebuilder = new StringBuilder();
        NoSqlDBUtils.add(schemaTable.getField(pKeyColumnName), indexKey, pKeyColumnValue, pKeyColumnName);
        KunderaCoreUtils.printQuery(
                "Get columns by id from:" + tableName + " for column:" + columnName + " where value:" + pKeyColumnValue,
                showQuery);
        Iterator<Row> rowsIter = tableAPI.tableIterator(indexKey, null, null);

        while (rowsIter.hasNext())
        {
            Row row = rowsIter.next();
            FieldDef fieldMetadata = schemaTable.getField(columnName);
            FieldValue value = row.get(columnName);
            foreignKeys.add((E) NoSqlDBUtils.get(fieldMetadata, value, null));
        }

        return foreignKeys;

    }
843093
public static <T> ExceptionalStream<T, SQLException> rows(final ResultSet resultSet, final String columnName) {
        N.checkArgNotNull(resultSet, "resultSet");
        N.checkArgNotNull(columnName, "columnName");

        return rows(resultSet, getColumnIndex(resultSet, columnName));
    }
708604
public static <E, T extends Collection<E>> T handleRsToBeanList(ResultSet rs, T collection, Class<E> elementBeanType) throws SQLException {
		final ResultSetMetaData meta = rs.getMetaData();
		final int columnCount = meta.getColumnCount();

		while (rs.next()) {
			collection.add(handleRow(columnCount, meta, rs, elementBeanType));
		}

		return collection;
	}