KickJava   Java API By Example, From Geeks To Geeks.

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


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: SubstringExpression.java,v 1.2 2002/10/17 21:00:58 pierreg0 Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import java.math.BigInteger JavaDoc;
14
15
16 class SubstringExpression extends CharacterExpression
17 {
18     public SubstringExpression(CharacterExpression str, NumericExpression begin)
19     {
20         super(str.getQueryStatement());
21
22         st.append("SUBSTRING(")
23       .append(str)
24       .append(" FROM ")
25       .append(begin.add(new IntegerLiteral(qs, BigInteger.ONE)))
26       .append(')');
27     }
28
29     public SubstringExpression(CharacterExpression str, NumericExpression begin, NumericExpression end)
30     {
31         super(str.getQueryStatement());
32
33         st.append("SUBSTRING(")
34       .append(str)
35       .append(" FROM ")
36       .append(begin.add(new IntegerLiteral(qs, BigInteger.ONE)))
37       .append(" FOR ")
38       .append(end.sub(begin))
39       .append(')');
40     }
41 }
42
Popular Tags