KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > types > StringDataValue


1 /*
2
3    Derby - Class org.apache.derby.iapi.types.StringDataValue
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.types;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 public interface StringDataValue extends ConcatableDataValue
27 {
28     // TRIM() types
29
public static final int BOTH = 0;
30     public static final int TRAILING = 1;
31     public static final int LEADING = 2;
32
33     /**
34      * The SQL concatenation '||' operator.
35      *
36      * @param leftOperand String on the left hand side of '||'
37      * @param rightOperand String on the right hand side of '||'
38      * @param result The result of a previous call to this method,
39      * null if not called yet.
40      *
41      * @return A ConcatableDataValue containing the result of the '||'
42      *
43      * @exception StandardException Thrown on error
44      */

45     public StringDataValue concatenate(
46                 StringDataValue leftOperand,
47                 StringDataValue rightOperand,
48                 StringDataValue result)
49         throws StandardException;
50
51     /**
52      * The SQL like() function with out escape clause.
53      *
54      * @param pattern the pattern to use
55      *
56      * @return A BooleanDataValue containing the result of the like
57      *
58      * @exception StandardException Thrown on error
59      */

60     public BooleanDataValue like(DataValueDescriptor pattern)
61                             throws StandardException;
62
63     /**
64      * The SQL like() function WITH escape clause.
65      *
66      * @param pattern the pattern to use
67      * @param escape the escape character
68      *
69      * @return A BooleanDataValue containing the result of the like
70      *
71      * @exception StandardException Thrown on error
72      */

73     public BooleanDataValue like(DataValueDescriptor pattern,
74                                     DataValueDescriptor escape)
75                             throws StandardException;
76
77     /**
78      * The SQL trim(), ltrim() and rtrim() functions.
79      *
80      * @param trimType Type of trim
81      * @param result The result of a previous call to this method,
82      * null if not called yet.
83      *
84      * @return A StringDataValue containing the result of the trim()
85      *
86      * @exception StandardException Thrown on error
87      */

88     public StringDataValue trim(
89                 int trimType,
90                 StringDataValue result)
91         throws StandardException;
92
93     /**
94      * Convert the string to upper case.
95      *
96      * @param result The result (reusable - allocate if null).
97      *
98      * @return The string converted to upper case.
99      *
100      * @exception StandardException Thrown on error
101      */

102     public StringDataValue upper(StringDataValue result)
103                             throws StandardException;
104
105     /**
106      * Convert the string to lower case.
107      *
108      * @param result The result (reusable - allocate if null).
109      *
110      * @return The string converted to lower case.
111      *
112      * @exception StandardException Thrown on error
113      */

114     public StringDataValue lower(StringDataValue result)
115                             throws StandardException;
116
117     /**
118      * Position in searchFrom of the first occurrence of this.value.
119      * The search begins from position start. 0 is returned if searchFrom does
120      * not contain this.value. Position 1 is the first character in searchFrom.
121      *
122      * @param searchFrom - The string to search from
123      * @param start - The position to search from in string searchFrom
124      * @param result - The object to return
125      *
126      * @return The position in searchFrom the fist occurrence of this.value.
127      * 0 is returned if searchFrom does not contain this.value.
128      * @exception StandardException Thrown on error
129      */

130     public NumberDataValue locate( StringDataValue searchFrom,
131                                     NumberDataValue start,
132                                     NumberDataValue result)
133                                     throws StandardException;
134
135
136     /**
137      * Get a char array. Typically, this is a simple
138      * getter that is cheaper than getString() because
139      * we always need to create a char array when
140      * doing I/O. Use this instead of getString() where
141      * reasonable.
142      * <p>
143      * <b>WARNING</b>: may return a character array that has spare
144      * characters at the end. MUST be used in conjunction
145      * with getLength() to be safe.
146      *
147      * @exception StandardException Thrown on error
148      */

149     public char[] getCharArray() throws StandardException;
150
151 }
152
Popular Tags