Skip to content

Commit

Permalink
TEIID-3847 preventing the call to setDate with a calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Nov 30, 2015
1 parent bd28fc1 commit 5aa3dec
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
Expand Down Expand Up @@ -271,6 +272,22 @@ public Object retrieveValue(CallableStatement results, int parameterIndex,
return super.retrieveValue(results, parameterIndex, expectedType);
}

@Override
public void bindValue(PreparedStatement stmt, Object param,
Class<?> paramType, int i) throws SQLException {
// Calendar based setX not supported by Hive
if (paramType.equals(Timestamp.class)) {
stmt.setTimestamp(i, (Timestamp) param);
}
if (paramType.equals(Date.class)) {
stmt.setDate(i, (Date) param);
}
if (paramType.equals(Time.class)) {
stmt.setTime(i, (Time) param);
}
super.bindValue(stmt, param, paramType, i);
}

protected FunctionMethod addAggregatePushDownFunction(String qualifier, String name, String returnType, String...paramTypes) {
FunctionMethod method = addPushDownFunction(qualifier, name, returnType, paramTypes);
AggregateAttributes attr = new AggregateAttributes();
Expand Down

0 comments on commit 5aa3dec

Please sign in to comment.