MCPcopy Create free account
hub / github.com/cmu-db/benchbase / getTimestamp

Method getTimestamp

src/main/java/com/oltpbenchmark/util/SQLUtil.java:174–194  ·  view source on GitHub ↗

Return a double from the given object Handles the different cases from the various DBMSs @param obj @return

(Object obj)

Source from the content-addressed store, hash-verified

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

Callers 11

loadConfigProfileMethod · 0.95
loadItemsMethod · 0.95
processItemRecordMethod · 0.95
loadConfigProfileMethod · 0.95
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
getOrderDetailsMethod · 0.80
getOrderLinesMethod · 0.80

Calls 3

getLongMethod · 0.95
getTimeMethod · 0.80
invokeMethod · 0.65

Tested by

no test coverage detected