Обсуждение: [JDBC] [pgjdbc/pgjdbc] 5b9edb: fix: Add fallback to setObject(int, Object)for Nu...

Поиск
Список
Период
Сортировка

[JDBC] [pgjdbc/pgjdbc] 5b9edb: fix: Add fallback to setObject(int, Object)for Nu...

От
Robert 'Bobby' Zenz
Дата:
  Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: 5b9edb7dfb1b281bffedf7c9f2583f2df354c0ea
      https://github.com/pgjdbc/pgjdbc/commit/5b9edb7dfb1b281bffedf7c9f2583f2df354c0ea
  Author: Robert 'Bobby' Zenz <Robert.Zenz@bonsaimind.org>
  Date:   2017-05-19 (Fri, 19 May 2017)

  Changed paths:
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java

  Log Message:
  -----------
  fix: Add fallback to setObject(int, Object) for Number (#812)

Add a fallback to the PgPreparedStatement.setObject(int, Object) method
which handles Number types. This allows support for BigInteger and
similar types (f.e. AtomicLong) which are not explicitly mentioned by
JDBC.

This fallback operates by invoking toString() on the Number, which is
the same method used by setBigDecimal(int, BigDecimal). Also,
setBigDecimal(int, BigDecimal) does now invoke setNumber(int, Number)
because they work the same way.

The tracking bug is #810.