KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > SqlDateExpression


1 /*
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: SqlDateExpression.java,v 1.4 2003/08/11 16:01:52 pierreg0 Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import java.util.List JavaDoc;
14
15
16 class SqlDateExpression extends SQLExpression
17 {
18     public SqlDateExpression(QueryStatement qs)
19     {
20         super(qs);
21     }
22
23     public SqlDateExpression(QueryStatement qs, QueryStatement.QueryColumn qsc)
24     {
25         super(qs, qsc);
26     }
27
28     public SqlDateExpression(String JavaDoc functionName, List JavaDoc args)
29     {
30         super(functionName, args);
31     }
32
33     public SqlDateExpression(SQLExpression operand1, DyadicOperator op, SQLExpression operand2)
34     {
35         super(operand1, op, operand2);
36     }
37
38     public BooleanExpression eq(SQLExpression expr)
39     {
40         if (expr instanceof NullLiteral)
41             return expr.eq(this);
42         else if (expr instanceof SqlDateExpression)
43             return new BooleanExpression(this, OP_EQ, expr);
44         else
45             return super.eq(expr);
46     }
47
48     public BooleanExpression noteq(SQLExpression expr)
49     {
50         if (expr instanceof NullLiteral)
51             return expr.noteq(this);
52         else if (expr instanceof SqlDateExpression)
53             return new BooleanExpression(this, OP_NOTEQ, expr);
54         else
55             return super.noteq(expr);
56     }
57
58     public BooleanExpression lt(SQLExpression expr)
59     {
60         if (expr instanceof SqlDateExpression)
61             return new BooleanExpression(this, OP_LT, expr);
62         else
63             return super.lt(expr);
64     }
65
66     public BooleanExpression lteq(SQLExpression expr)
67     {
68         if (expr instanceof SqlDateExpression)
69             return new BooleanExpression(this, OP_LTEQ, expr);
70         else
71             return super.lteq(expr);
72     }
73
74     public BooleanExpression gt(SQLExpression expr)
75     {
76         if (expr instanceof SqlDateExpression)
77             return new BooleanExpression(this, OP_GT, expr);
78         else
79             return super.gt(expr);
80     }
81
82     public BooleanExpression gteq(SQLExpression expr)
83     {
84         if (expr instanceof SqlDateExpression)
85             return new BooleanExpression(this, OP_GTEQ, expr);
86         else
87             return super.gteq(expr);
88     }
89
90     public BooleanExpression in(SQLExpression expr)
91     {
92         return new BooleanExpression(this, OP_IN, expr);
93     }
94 }
95
Popular Tags