chore(bigquery-jdbc): refactor PreparedStatement and CallableStatement - #13849
chore(bigquery-jdbc): refactor PreparedStatement and CallableStatement#13849Neenu1995 wants to merge 58 commits into
Conversation
…d Calendar date setters
… CallableStatement
…yParameterMetaData
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…ryJdbcSqlFeatureNotSupportedException
…nsive copying across statement interfaces
…d-java into ps-part2-metadata
… in BigQueryTypeCoercionUtility
… and update CallableStatement and ResultSet to delegate to BigQueryTypeCoercionUtility
…rom BigQueryParameterHandler
…rom BigQueryParameterHandler and delegate directly to BigQueryTypeCoercionUtility
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…rameterHandlerTest to FieldValueTypeBigQueryCoercionUtilityTest
…r in BigQueryTypeCoercionUtility
…d-java into ps-part3-callable
…PreparedStatement
There was a problem hiding this comment.
Code Review
This pull request refactors parameter handling in BigQueryCallableStatement and BigQueryPreparedStatement by standardizing parameter names, adding checkClosed() validation, and introducing helper methods like getRawParameter. Feedback on these changes highlights a few inconsistencies: BigQueryCallableStatement.setDate uses convertDateToCalendar instead of convertDateWithCalendar, the overloaded getObject methods are missing checkClosed() checks, and temporal types are handled inconsistently between BigQueryPreparedStatement (bound as strings) and BigQueryCallableStatement (bound as raw temporal objects).
| return null; | ||
| } | ||
| if (sqlType == StandardSQLTypeName.INT64 | ||
| && (parameterValue instanceof Short |
There was a problem hiding this comment.
Why short/byte are special cased here?
| || parameterValue instanceof BigInteger)) { | ||
| return ((Number) parameterValue).longValue(); | ||
| } | ||
| if (sqlType == StandardSQLTypeName.FLOAT64 && parameterValue instanceof Float) { |
| public <T> T getObject(String parameterName, Class<T> type) throws SQLException { | ||
| checkClosed(); | ||
| return coerceValueToType( | ||
| getParameterAndTrackNull(parameterName), type, "'" + parameterName + "'"); |
There was a problem hiding this comment.
Why quotes? I assume it is used in logger? if so, logger should add quotes
| public void registerOutParameter(int paramIndex, int sqlType) throws SQLException { | ||
| LOG.finer("registerOutParameter: paramIndex %s, sqlType %s", paramIndex, sqlType); | ||
| public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { | ||
| LOG.finer("registerOutParameter: parameterIndex %s, sqlType %s", parameterIndex, sqlType); |
wasNull(): Routed all parameter getter paths inBigQueryCallableStatementthrough centralizedgetRawParameterhelpers, ensuring consistentwasNull()state tracking across all fast-path and fallback reads.checkClosed()checks to all implemented methods inBigQueryCallableStatementandBigQueryPreparedStatement.LOG.finerentry logging.getRef,getSQLXML) to directly throwBigQueryJdbcSqlFeatureNotSupportedException.