Return a double from the given object Handles the different cases from the various DBMSs @param obj @return
(Object obj)
| 172 | * @return |
| 173 | */ |
| 174 | public static Timestamp getTimestamp(Object obj) { |
| 175 | if (obj == null) { |
| 176 | return (null); |
| 177 | } |
| 178 | |
| 179 | if (obj instanceof Timestamp) { |
| 180 | return (Timestamp) obj; |
| 181 | } else if (obj instanceof Date) { |
| 182 | return new Timestamp(((Date) obj).getTime()); |
| 183 | } else if (ORACLE_TIMESTAMP != null && ORACLE_TIMESTAMP.isInstance(obj)) { |
| 184 | try { |
| 185 | // https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/sql/TIMESTAMP.html#timestampValue__ |
| 186 | return (Timestamp) TIMESTAMP_VALUE_METHOD.invoke(ORACLE_TIMESTAMP.cast(obj)); |
| 187 | } catch (IllegalAccessException | InvocationTargetException e) { |
| 188 | throw new RuntimeException(e); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | Long timestamp = SQLUtil.getLong(obj); |
| 193 | return (timestamp != null ? new Timestamp(timestamp) : null); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Return the internal sequence name for the given Column |
no test coverage detected