org.apache.derby.impl.sql.execute
Class CurrentDatetime

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.CurrentDatetime

public class CurrentDatetime
extends java.lang.Object

CurrentDatetime provides execution support for ensuring that the current datetime is evaluated only once for a statement. The same value is returned for every CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP in the statement.

This is expected to be used by an activation and its result set, and so 'forget' must be called whenever you want to reuse the CurrentDatetime object for additional executions of the statement.

Author:
ames

Field Summary
private  java.sql.Date currentDate
          Holds the SQL DATE version of the current datetime.
private  java.util.Date currentDatetime
          Holds the current datetime on the first evaluation of a current function in a statement, which contains all available fields.
private  java.sql.Time currentTime
          Holds the SQL TIME version of the current datetime.
private  java.sql.Timestamp currentTimestamp
          Holds the SQL TIMESTAMP version of the current datetime.
 
Constructor Summary
CurrentDatetime()
          The constructor is public; note we wait until evaluation to put any values into the fields.
 
Method Summary
 void forget()
          This is called prior to each execution of the statement, to ensure that it starts over with a new current datetime value.
 java.sql.Date getCurrentDate()
           
 java.sql.Time getCurrentTime()
           
 java.sql.Timestamp getCurrentTimestamp()
           
private  void setCurrentDatetime()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentDatetime

private java.util.Date currentDatetime
Holds the current datetime on the first evaluation of a current function in a statement, which contains all available fields.


currentDate

private java.sql.Date currentDate
Holds the SQL DATE version of the current datetime.


currentTime

private java.sql.Time currentTime
Holds the SQL TIME version of the current datetime.


currentTimestamp

private java.sql.Timestamp currentTimestamp
Holds the SQL TIMESTAMP version of the current datetime.

Constructor Detail

CurrentDatetime

public CurrentDatetime()
The constructor is public; note we wait until evaluation to put any values into the fields.

Method Detail

setCurrentDatetime

private final void setCurrentDatetime()

getCurrentDate

public java.sql.Date getCurrentDate()

getCurrentTime

public java.sql.Time getCurrentTime()

getCurrentTimestamp

public java.sql.Timestamp getCurrentTimestamp()

forget

public void forget()
This is called prior to each execution of the statement, to ensure that it starts over with a new current datetime value.


Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.