01: /*
02: * Copyright 2002 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: SqlDateExpression.java,v 1.4 2003/08/11 16:01:52 pierreg0 Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: import java.util.List;
14:
15: class SqlDateExpression extends SQLExpression {
16: public SqlDateExpression(QueryStatement qs) {
17: super (qs);
18: }
19:
20: public SqlDateExpression(QueryStatement qs,
21: QueryStatement.QueryColumn qsc) {
22: super (qs, qsc);
23: }
24:
25: public SqlDateExpression(String functionName, List args) {
26: super (functionName, args);
27: }
28:
29: public SqlDateExpression(SQLExpression operand1, DyadicOperator op,
30: SQLExpression operand2) {
31: super (operand1, op, operand2);
32: }
33:
34: public BooleanExpression eq(SQLExpression expr) {
35: if (expr instanceof NullLiteral)
36: return expr.eq(this );
37: else if (expr instanceof SqlDateExpression)
38: return new BooleanExpression(this , OP_EQ, expr);
39: else
40: return super .eq(expr);
41: }
42:
43: public BooleanExpression noteq(SQLExpression expr) {
44: if (expr instanceof NullLiteral)
45: return expr.noteq(this );
46: else if (expr instanceof SqlDateExpression)
47: return new BooleanExpression(this , OP_NOTEQ, expr);
48: else
49: return super .noteq(expr);
50: }
51:
52: public BooleanExpression lt(SQLExpression expr) {
53: if (expr instanceof SqlDateExpression)
54: return new BooleanExpression(this , OP_LT, expr);
55: else
56: return super .lt(expr);
57: }
58:
59: public BooleanExpression lteq(SQLExpression expr) {
60: if (expr instanceof SqlDateExpression)
61: return new BooleanExpression(this , OP_LTEQ, expr);
62: else
63: return super .lteq(expr);
64: }
65:
66: public BooleanExpression gt(SQLExpression expr) {
67: if (expr instanceof SqlDateExpression)
68: return new BooleanExpression(this , OP_GT, expr);
69: else
70: return super .gt(expr);
71: }
72:
73: public BooleanExpression gteq(SQLExpression expr) {
74: if (expr instanceof SqlDateExpression)
75: return new BooleanExpression(this , OP_GTEQ, expr);
76: else
77: return super .gteq(expr);
78: }
79:
80: public BooleanExpression in(SQLExpression expr) {
81: return new BooleanExpression(this, OP_IN, expr);
82: }
83: }
|