01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.ejb.query;
12:
13: /**
14: * Functions that return date/time.
15: */
16: public class DateFunctionNode extends Node {
17:
18: public static final int CURRENT_DATE = 1;
19: public static final int CURRENT_TIME = 2;
20: public static final int CURRENT_TIMESTAMP = 3;
21:
22: private int function;
23:
24: public DateFunctionNode(int function) {
25: this .function = function;
26: }
27:
28: public int getFunction() {
29: return function;
30: }
31:
32: public String getFunctionStr() {
33: switch (function) {
34: case CURRENT_DATE:
35: return "CURRENT_DATE";
36: case CURRENT_TIME:
37: return "CURRENT_TIME";
38: case CURRENT_TIMESTAMP:
39: return "CURRENT_TIMESTAMP";
40: }
41: return "<? function " + function + " ?>";
42: }
43:
44: public Object arrive(NodeVisitor v, Object msg) {
45: return v.arriveDateFunctionNode(this , msg);
46: }
47:
48: public String toStringImp() {
49: return getFunctionStr();
50: }
51:
52: }
|