zeroflag commented on a change in pull request #1633:
URL: https://github.com/apache/hive/pull/1633#discussion_r528568530
##########
File path: hplsql/src/main/java/org/apache/hive/hplsql/Var.java
##########
@@ -258,44 +256,35 @@ public void setValue(Object value) {
this.value = value;
}
}
-
- /**
- * Set the new value from the result set
- */
- public Var setValue(ResultSet rs, ResultSetMetaData rsm, int idx) throws
SQLException {
- int type = rsm.getColumnType(idx);
+
+ public Var setValue(QueryResult queryResult, int idx) {
+ int type = queryResult.jdbcType(idx);
if (type == java.sql.Types.CHAR || type == java.sql.Types.VARCHAR) {
- cast(new Var(rs.getString(idx)));
- }
- else if (type == java.sql.Types.INTEGER || type == java.sql.Types.BIGINT ||
- type == java.sql.Types.SMALLINT || type == java.sql.Types.TINYINT) {
- cast(new Var(Long.valueOf(rs.getLong(idx))));
- }
- else if (type == java.sql.Types.DECIMAL || type == java.sql.Types.NUMERIC)
{
- cast(new Var(rs.getBigDecimal(idx)));
- }
- else if (type == java.sql.Types.FLOAT || type == java.sql.Types.DOUBLE) {
- cast(new Var(Double.valueOf(rs.getDouble(idx))));
+ cast(new Var(queryResult.column(idx, String.class)));
+ } else if (type == java.sql.Types.INTEGER || type == java.sql.Types.BIGINT
||
+ type == java.sql.Types.SMALLINT || type == java.sql.Types.TINYINT)
{
+ cast(new Var(Long.valueOf(queryResult.column(idx, Long.class))));
+ } else if (type == java.sql.Types.DECIMAL || type ==
java.sql.Types.NUMERIC) {
+ cast(new Var(queryResult.column(idx, BigDecimal.class)));
+ } else if (type == java.sql.Types.FLOAT || type == java.sql.Types.DOUBLE) {
+ cast(new Var(Double.valueOf(queryResult.column(idx, Double.class))));
}
return this;
}
-
- /**
- * Set ROW values from the result set
- */
- public Var setValues(ResultSet rs, ResultSetMetaData rsm) throws
SQLException {
+
+ public Var setValues(QueryResult queryResult) {
Row row = (Row)this.value;
- int idx = 1;
+ int idx = 0;
Review comment:
I added a javadoc explaining the difference.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]