@Override public void write(DataBuffer buff, Object obj) { Timestamp t = (Timestamp) obj; writeValue(buff, ValueTimestamp.get(t)); }
/** * Updates a column in the current or insert row. * * @param columnIndex (1,2,...) * @param x the value * @throws SQLException if the result set is closed or not updatable */ @Override public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp(" + columnIndex + ", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
/** * Updates a column in the current or insert row. * * @param columnLabel the column label * @param x the value * @throws SQLException if the result set is closed or not updatable */ @Override public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp(" + quote(columnLabel) + ", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
/** * Sets the value of a parameter. * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value * @throws SQLException if this object is closed */ @Override public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTimestamp(" + parameterIndex + ", " + quoteTimestamp(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
v = value == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(value); break;
return ValueTime.get((Time) x); } else if (x instanceof Timestamp) { return ValueTimestamp.get((Timestamp) x); } else if (x instanceof java.util.Date) { return ValueTimestamp.get(new Timestamp(((java.util.Date) x).getTime())); } else if (x instanceof java.io.Reader) { Reader r = new BufferedReader((java.io.Reader) x);
value = ValueInt.get(0).convertTo(type); } else if (dt.type == Value.TIMESTAMP) { value = ValueTimestamp.get(new Timestamp(session.getTransactionStart())); } else if (dt.type == Value.TIME) { value = ValueTime.fromNanos(0);
case CURRENT_TIMESTAMP: { long now = session.getTransactionStart(); ValueTimestamp vt = ValueTimestamp.get(new Timestamp(now)); if (v0 != null) { Mode mode = database.getMode();
c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); result = ValueTimestamp.get(new java.sql.Timestamp(c.getTimeInMillis())); } else { double d = v0.getDouble(); result = ValueTimestamp.get(dateadd(v0.getString(), v1.getInt(), v2.getTimestamp())); break; case DATE_DIFF: String tz = v3 == null ? null : v3 == ValueNull.INSTANCE ? null : v3.getString(); java.util.Date d = DateTimeUtils.parseDateTime(v0.getString(), v1.getString(), locale, tz); result = ValueTimestamp.get(new Timestamp(d.getTime()));