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: SubstringExpression.java,v 1.2 2002/10/17 21:00:58 pierreg0 Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: import java.math.BigInteger;
14:
15: class SubstringExpression extends CharacterExpression {
16: public SubstringExpression(CharacterExpression str,
17: NumericExpression begin) {
18: super (str.getQueryStatement());
19:
20: st.append("SUBSTRING(").append(str).append(" FROM ").append(
21: begin.add(new IntegerLiteral(qs, BigInteger.ONE)))
22: .append(')');
23: }
24:
25: public SubstringExpression(CharacterExpression str,
26: NumericExpression begin, NumericExpression end) {
27: super (str.getQueryStatement());
28:
29: st.append("SUBSTRING(").append(str).append(" FROM ").append(
30: begin.add(new IntegerLiteral(qs, BigInteger.ONE)))
31: .append(" FOR ").append(end.sub(begin)).append(')');
32: }
33: }
|