Source Code Cross Referenced for DataValueDescriptor.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » types » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.types 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.types.DataValueDescriptor
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.iapi.types;
023:
024:        import org.apache.derby.iapi.services.io.ArrayInputStream;
025:
026:        import org.apache.derby.iapi.error.StandardException;
027:        import org.apache.derby.iapi.types.Orderable;
028:        import org.apache.derby.iapi.services.io.Storable;
029:
030:        import java.io.InputStream;
031:        import java.io.IOException;
032:        import java.sql.Date;
033:        import java.sql.ResultSet;
034:        import java.sql.PreparedStatement;
035:        import java.sql.Time;
036:        import java.sql.Timestamp;
037:        import java.sql.SQLException;
038:        import java.util.Calendar;
039:
040:        /**
041:         * The DataValueDescriptor interface provides methods to get the data from
042:         * a column returned by a statement.  This interface has the same methods
043:         * as NoCastDataValueDescriptor - the only reason it exists is for purposes
044:         * of internal documentation, to make it clear when the different getXXX
045:         * methods throw exceptions for illegal conversions.
046:         * <p>
047:         * This interface matches the getXXX methods on java.sql.ResultSet. This means
048:         * everyone satisfies getString and getObject; all of the numeric types, within
049:         * the limits of representation, satisfy all of the numeric getXXX methods;
050:         * all of the character types satisfy all of the getXXX methods except
051:         * getBytes and getBinaryStream; all of the binary types satisfy getBytes and
052:         * all of the getXXXStream methods; Date satisfies getDate and getTimestamp;
053:         * Time satisfies getTime; and Timestamp satisfies all of the date/time getXXX 
054:         * methods.
055:         * The "preferred" method (one that will always work, I presume) is the one that
056:         * matches the type most closely. See the comments below for
057:         * "preferences".  See the JDBC guide for details.
058:         * <p>
059:         * This interface does not include the getXXXStream methods.
060:         * <p>
061:         * The preferred methods for JDBC are:
062:         * <p>
063:         * CHAR and VARCHAR - getString()
064:         * <p>
065:         * BIT - getBoolean()
066:         * <p>
067:         * TINYINT - getByte()
068:         * <p>
069:         * SMALLINT - getShort()
070:         * <p>
071:         * INTEGER - getInt()
072:         * <p>
073:         * BIGINT - getLong()
074:         * <p>
075:         * REAL - getFloat()
076:         * <p>
077:         * FLOAT and DOUBLE - getDouble()
078:         * <p>
079:         * DECIMAL and NUMERIC - getBigDecimal()
080:         * <p>
081:         * BINARY and VARBINARY - getBytes()
082:         * <p>
083:         * DATE - getDate()
084:         * <p>
085:         * TIME - getTime()
086:         * <p>
087:         * TIMESTAMP - getTimestamp()
088:         * <p>
089:         * No JDBC type corresponds to getObject().  Use this for user-defined types
090:         * or to get the JDBC types as java Objects.  All primitive types will be
091:         * wrapped in their corresponding Object type, i.e. int will be
092:         * wrapped in an Integer.
093:         * <p>
094:         * getStream() 
095:         * 
096:         * @author Jeff Lichtman
097:         */
098:
099:        public interface DataValueDescriptor extends Storable, Orderable {
100:
101:            /**
102:             * Gets the length of the data value.  The meaning of this is
103:             * implementation-dependent.  For string types, it is the number of
104:             * characters in the string.  For numeric types, it is the number of
105:             * bytes used to store the number.  This is the actual length
106:             * of this value, not the length of the type it was defined as.
107:             * For example, a VARCHAR value may be shorter than the declared
108:             * VARCHAR (maximum) length.
109:             *
110:             * @return	The length of the data value
111:             *
112:             * @exception StandardException   On error
113:             */
114:            int getLength() throws StandardException;
115:
116:            /**
117:             * Gets the value in the data value descriptor as a String.
118:             * Throws an exception if the data value is not a string.
119:             *
120:             * @return	The data value as a String.
121:             *
122:             * @exception StandardException   Thrown on error
123:             */
124:            String getString() throws StandardException;
125:
126:            /**
127:             * Gets the value in the data value descriptor as a trace string.
128:             * If the value itself is not suitable for tracing purposes, a more
129:             * suitable representation is returned. For instance, data values
130:             * represented as streams are not materialized. Instead, information about
131:             * the associated stream is given.
132:             */
133:            String getTraceString() throws StandardException;
134:
135:            /**
136:             * Gets the value in the data value descriptor as a boolean.
137:             * Throws an exception if the data value is not a boolean.
138:             * For DataValueDescriptor, this is the preferred interface
139:             * for BIT, but for this no-casting interface, it isn't, because
140:             * BIT is stored internally as a Bit, not as a Boolean.
141:             *
142:             * @return	The data value as a boolean.
143:             *
144:             * @exception StandardException   Thrown on error
145:             */
146:            boolean getBoolean() throws StandardException;
147:
148:            /**
149:             * Gets the value in the data value descriptor as a byte.
150:             * Throws an exception if the data value is not a byte.
151:             *
152:             * @return	The data value as a byte.
153:             *
154:             * @exception StandardException   Thrown on error
155:             */
156:            byte getByte() throws StandardException;
157:
158:            /**
159:             * Gets the value in the data value descriptor as a short.
160:             * Throws an exception if the data value is not a short.
161:             *
162:             * @return	The data value as a short.
163:             *
164:             * @exception StandardException   Thrown on error
165:             */
166:            short getShort() throws StandardException;
167:
168:            /**
169:             * Gets the value in the data value descriptor as an int.
170:             * Throws an exception if the data value is not an int.
171:             *
172:             * @return	The data value as a int.
173:             *
174:             * @exception StandardException   Thrown on error
175:             */
176:            int getInt() throws StandardException;
177:
178:            /**
179:             * Gets the value in the data value descriptor as a long.
180:             * Throws an exception if the data value is not a long.
181:             *
182:             * @return	The data value as a long.
183:             *
184:             * @exception StandardException   Thrown on error
185:             */
186:            long getLong() throws StandardException;
187:
188:            /**
189:             * Gets the value in the data value descriptor as a float.
190:             * Throws an exception if the data value is not a float.
191:             *
192:             * @return	The data value as a float.
193:             *
194:             * @exception StandardException   Thrown on error
195:             */
196:            float getFloat() throws StandardException;
197:
198:            /**
199:             * Gets the value in the data value descriptor as a double.
200:             * Throws an exception if the data value is not a double.
201:             *
202:             * @return	The data value as a double.
203:             *
204:             * @exception StandardException   Thrown on error
205:             */
206:            double getDouble() throws StandardException;
207:
208:            /**
209:             * How should this value be obtained so that it can
210:             * be converted to a BigDecimal representation.
211:             * @return Types.CHAR for String conversion through getString
212:             * Types.DECIMAL for BigDecimal through getObject or Types.BIGINT
213:             * for long conversion through getLong
214:             * @exception StandardException Conversion is not possible
215:             */
216:            int typeToBigDecimal() throws StandardException;
217:
218:            /**
219:             * Gets the value in the data value descriptor as a byte array.
220:             * Throws an exception if the data value is not a byte array.
221:             *
222:             * @return	The data value as a byte[].
223:             *
224:             * @exception StandardException  Thrown on error
225:             */
226:            byte[] getBytes() throws StandardException;
227:
228:            /**
229:             * Gets the value in the data value descriptor as a java.sql.Date.
230:             * Throws an exception if the data value is not a Date.
231:             *	@param cal calendar for object creation
232:             * @return	The data value as a java.sql.Date.
233:             *
234:             * @exception StandardException   Thrown on error
235:             */
236:            Date getDate(java.util.Calendar cal) throws StandardException;
237:
238:            /**
239:             * Gets the value in the data value descriptor as a java.sql.Time.
240:             * Throws an exception if the data value is not a Time.
241:             *	@param cal calendar for object creation
242:             *
243:             * @return	The data value as a java.sql.Time.
244:             *
245:             * @exception StandardException   Thrown on error
246:             */
247:            Time getTime(java.util.Calendar cal) throws StandardException;
248:
249:            /**
250:             * Gets the value in the data value descriptor as a java.sql.Timestamp.
251:             * Throws an exception if the data value is not a Timestamp.
252:             *	@param cal calendar for object creation
253:             * @return	The data value as a java.sql.Timestamp.
254:             *
255:             * @exception StandardException   Thrown on error
256:             */
257:            Timestamp getTimestamp(java.util.Calendar cal)
258:                    throws StandardException;
259:
260:            /**
261:             * Gets the value in the data value descriptor as a Java Object.
262:             * The type of the Object will be the Java object type corresponding
263:             * to the data value's SQL type. JDBC defines a mapping between Java
264:             * object types and SQL types - we will allow that to be extended
265:             * through user type definitions. Throws an exception if the data
266:             * value is not an object (yeah, right).
267:             *
268:             * @return	The data value as an Object.
269:             *
270:             * @exception StandardException   Thrown on error
271:             */
272:            Object getObject() throws StandardException;
273:
274:            /**
275:             * Gets the value in the data value descriptor as a Java InputStream.
276:             * Only data types that implements StreamStorable will have stream states.
277:             *
278:             * @return	The stream state of the data value.
279:             *
280:             * @exception StandardException   Throws an exception if the data value
281:             *								  cannot be received as a stream.
282:             */
283:            InputStream getStream() throws StandardException;
284:
285:            /**
286:             * Clone this DataValueDescriptor. Results in a new object
287:             * that has the same value as this but can be modified independently.
288:             *
289:             * @return A clone of the DataValueDescriptor with the same initial value as this.
290:             */
291:            public DataValueDescriptor getClone();
292:
293:            /**
294:             * Get a new null value of the same type as this data value.
295:             *
296:             */
297:            public DataValueDescriptor getNewNull();
298:
299:            /**
300:             * Set the value based on the value for the specified DataValueDescriptor
301:             * from the specified ResultSet.
302:             *
303:             * @param resultSet		The specified ResultSet.
304:             * @param colNumber		The 1-based column # into the resultSet.
305:             * @param isNullable	Whether or not the column is nullable
306:             *						(No need to call wasNull() if not)
307:             * 
308:             * @exception StandardException		Thrown on error
309:             * @exception SQLException		Error accessing the result set
310:             */
311:            public void setValueFromResultSet(ResultSet resultSet,
312:                    int colNumber, boolean isNullable)
313:                    throws StandardException, SQLException;
314:
315:            /**
316:            	Set this value into a PreparedStatement. This method must
317:            	handle setting NULL into the PreparedStatement.
318:
319:            	@exception SQLException thrown by the PreparedStatement object
320:            	@exception StandardException thrown by me accessing my value.
321:             */
322:            public void setInto(PreparedStatement ps, int position)
323:                    throws SQLException, StandardException;
324:
325:            /**
326:            	Set this value into a ResultSet for a subsequent ResultSet.insertRow
327:            	or ResultSet.updateRow. This method will only be called for non-null values.
328:
329:            	@exception SQLException thrown by the ResultSet object
330:            	@exception StandardException thrown by me accessing my value.
331:             */
332:            public void setInto(ResultSet rs, int position)
333:                    throws SQLException, StandardException;
334:
335:            /**
336:             * Set the value of this DataValueDescriptor to the given int value
337:             *
338:             * @param theValue	The value to set this DataValueDescriptor to
339:             *
340:             * @exception StandardException		Thrown on error
341:             */
342:            public void setValue(int theValue) throws StandardException;
343:
344:            /**
345:             * Set the value of this DataValueDescriptor to the given double value
346:             *
347:             * @param theValue	The value to set this DataValueDescriptor to
348:             *
349:             * @exception StandardException		Thrown on error
350:             */
351:            public void setValue(double theValue) throws StandardException;
352:
353:            /**
354:             * Set the value of this DataValueDescriptor to the given double value
355:             *
356:             * @param theValue	A Double containing the value to set this
357:             *					DataValueDescriptor to.  Null means set the value
358:             *					to SQL null.
359:             *
360:             * @exception StandardException		Thrown on error
361:             */
362:
363:            public void setValue(float theValue) throws StandardException;
364:
365:            /**
366:             * Set the value of this DataValueDescriptor to the given short value
367:             *
368:             * @param theValue	The value to set this DataValueDescriptor to
369:             *
370:             * @exception StandardException		Thrown on error
371:             */
372:            public void setValue(short theValue) throws StandardException;
373:
374:            /**
375:             * Set the value of this DataValueDescriptor to the given long value
376:             *
377:             * @param theValue	The value to set this DataValueDescriptor to
378:             *
379:             * @exception StandardException		Thrown on error
380:             */
381:            public void setValue(long theValue) throws StandardException;
382:
383:            /**
384:             * Set the value of this DataValueDescriptor to the given byte value
385:             *
386:             * @param theValue	The value to set this DataValueDescriptor to
387:             *
388:             */
389:            public void setValue(byte theValue) throws StandardException;
390:
391:            /**
392:             * Set the value.
393:             *
394:             * @param theValue	Contains the boolean value to set this to
395:             *
396:             */
397:            public void setValue(boolean theValue) throws StandardException;
398:
399:            /**
400:             * Set the value of this DataValueDescriptor.
401:             *
402:             * @param theValue	The byte value to set this DataValueDescriptor to
403:             *
404:             */
405:            public void setValue(byte[] theValue) throws StandardException;
406:
407:            /**
408:            	Set this value from an application supplied java.math.BigDecimal.
409:            	This is to support the PreparedStatement.setBigDecimal method and
410:            	similar JDBC methods that allow an application to pass in a BigDecimal
411:            	to any SQL type.
412:            	Parameter is declared as java.lang.Number to allow compilation
413:            	under J2ME/CDC/Foundation. This method will not be called in
414:            	any environment that does not support java.math.BigDecimal.
415:
416:            	@param bigDecimal required to be a BigDecimal or null.
417:             */
418:            public void setBigDecimal(Number bigDecimal)
419:                    throws StandardException;
420:
421:            /**
422:             * Set the value of this DataValueDescriptor.
423:             *
424:             * @param theValue	The String value to set this DataValueDescriptor to
425:             *
426:             */
427:            public void setValue(String theValue) throws StandardException;
428:
429:            /**
430:             * Set the value of this DataValueDescriptor.
431:             *
432:             * @param theValue	The Time value to set this DataValueDescriptor to
433:             *
434:             */
435:            public void setValue(Time theValue) throws StandardException;
436:
437:            /**
438:             * Set the value of this DataValueDescriptor.
439:             *
440:             * @param theValue	The Time value to set this DataValueDescriptor to
441:             * @param cal The time zone from the calendar is used to construct the database time value
442:             *
443:             */
444:            public void setValue(Time theValue, Calendar cal)
445:                    throws StandardException;
446:
447:            /**
448:             * Set the value of this DataValueDescriptor.
449:             *
450:             * @param theValue	The Timestamp value to set this DataValueDescriptor to
451:             *
452:             */
453:            public void setValue(Timestamp theValue) throws StandardException;
454:
455:            /**
456:             * Set the value of this DataValueDescriptor.
457:             *
458:             * @param theValue	The Timestamp value to set this DataValueDescriptor to
459:             * @param cal The time zone from the calendar is used to construct the database timestamp value
460:             *
461:             */
462:            public void setValue(Timestamp theValue, Calendar cal)
463:                    throws StandardException;
464:
465:            /**
466:             * Set the value of this DataValueDescriptor.
467:             *
468:             * @param theValue	The Date value to set this DataValueDescriptor to
469:             *
470:             */
471:            public void setValue(Date theValue) throws StandardException;
472:
473:            /**
474:             * Set the value of this DataValueDescriptor.
475:             *
476:             * @param theValue	The Date value to set this DataValueDescriptor to
477:             * @param cal The time zone from the calendar is used to construct the database date value
478:             *
479:             */
480:            public void setValue(Date theValue, Calendar cal)
481:                    throws StandardException;
482:
483:            /**
484:             * Set the value of this DataValueDescriptor from another.
485:             *
486:             * @param theValue	The Date value to set this DataValueDescriptor to
487:             *
488:             */
489:            public void setValue(DataValueDescriptor theValue)
490:                    throws StandardException;
491:
492:            /**
493:             * Set the value to SQL null.
494:             */
495:
496:            void setToNull();
497:
498:            /**
499:            	Normalize the source value to this type described by this class
500:            	and the passed in DataTypeDescriptor. The type of the DataTypeDescriptor
501:            	must match this class.
502:             */
503:            public void normalize(DataTypeDescriptor dtd,
504:                    DataValueDescriptor source) throws StandardException;
505:
506:            /**
507:             * The SQL "IS NULL" operator.  Returns true if this value
508:             * is null.
509:             *	 *
510:             * @return	True if this value is null.
511:             *
512:             */
513:            public BooleanDataValue isNullOp();
514:
515:            /**
516:             * The SQL "IS NOT NULL" operator.  Returns true if this value
517:             * is not null.
518:             *
519:             *
520:             * @return	True if this value is not null.
521:             *
522:             */
523:            public BooleanDataValue isNotNull();
524:
525:            /**
526:             * Get the SQL name of the datatype
527:             *
528:             * @return	The SQL name of the datatype
529:             */
530:            public String getTypeName();
531:
532:            /**
533:             * Set this value from an Object. Used from CAST of a Java type to
534:             * another type, including SQL types. If the passed instanceOfResultType
535:             * is false then the object is not an instance of the declared
536:             * type resultTypeClassName. Usually an exception should be thrown.
537:             *
538:             * @param value					The new value
539:             * @param instanceOfResultType	Whether or not the new value 
540:             *								is an instanceof the result type.
541:             * @param resultTypeClassName   The class name of the resulting (declared) type 
542:             *                              (for error messages only).
543:             *
544:             * @exception StandardException		Thrown on error
545:             */
546:            public void setObjectForCast(Object value,
547:                    boolean instanceOfResultType, String resultTypeClassName)
548:                    throws StandardException;
549:
550:            /**
551:             * Read the DataValueDescriptor from the stream.
552:             * <p>
553:             * Initialize the data value by reading it's values from the 
554:             * ArrayInputStream.  This interface is provided as a way to achieve
555:             * possible performance enhancement when reading an array can be 
556:             * optimized over reading from a generic stream from readExternal().
557:             *
558:             * @param ais    The array stream positioned at the beginning of the 
559:             *               byte stream to read from.
560:             *
561:             * @exception  IOException              Usual error is if you try to read 
562:             *                                      past limit on the stream.
563:             * @exception  ClassNotFoundException   If a necessary class can not be 
564:             *                                      found while reading the object from
565:             *                                      the stream.
566:             **/
567:            public void readExternalFromArray(ArrayInputStream ais)
568:                    throws IOException, ClassNotFoundException;
569:
570:            /**
571:             * Each built-in type in JSQL has a precedence.  This precedence determines
572:             * how to do type promotion when using binary operators.  For example, float
573:             * has a higher precedence than int, so when adding an int to a float, the
574:             * result type is float.
575:             *
576:             * The precedence for some types is arbitrary.  For example, it doesn't
577:             * matter what the precedence of the boolean type is, since it can't be
578:             * mixed with other types.  But the precedence for the number types is
579:             * critical.  The SQL standard requires that exact numeric types be
580:             * promoted to approximate numeric when one operator uses both.  Also,
581:             * the precedence is arranged so that one will not lose precision when
582:             * promoting a type.
583:             *
584:             * @return		The precedence of this type.
585:             */
586:            int typePrecedence();
587:
588:            /**
589:             * The SQL language = operator.  This method is called from the language
590:             * module.  The storage module uses the compare method in Orderable.
591:             *
592:             * @param left		The value on the left side of the operator
593:             * @param right		The value on the right side of the operator
594:             *
595:             * @return	A BooleanDataValue telling the result of the comparison
596:             *
597:             * @exception StandardException		Thrown on error
598:             */
599:            public BooleanDataValue equals(DataValueDescriptor left,
600:                    DataValueDescriptor right) throws StandardException;
601:
602:            /**
603:             * The SQL language <> operator.  This method is called from the language
604:             * module.  The storage module uses the compare method in Orderable.
605:             *
606:             * @param left		The value on the left side of the operator
607:             * @param right		The value on the right side of the operator
608:             *
609:             * @return	A BooleanDataValue telling the result of the comparison
610:             *
611:             * @exception StandardException		Thrown on error
612:             */
613:            public BooleanDataValue notEquals(DataValueDescriptor left,
614:                    DataValueDescriptor right) throws StandardException;
615:
616:            /**
617:             * The SQL language < operator.  This method is called from the language
618:             * module.  The storage module uses the compare method in Orderable.
619:             *
620:             * @param left		The value on the left side of the operator
621:             * @param right		The value on the right side of the operator
622:             *
623:             * @return	A BooleanDataValue telling the result of the comparison
624:             *
625:             * @exception StandardException		Thrown on error
626:             */
627:            public BooleanDataValue lessThan(DataValueDescriptor left,
628:                    DataValueDescriptor right) throws StandardException;
629:
630:            /**
631:             * The SQL language > operator.  This method is called from the language
632:             * module.  The storage module uses the compare method in Orderable.
633:             *
634:             * @param left		The value on the left side of the operator
635:             * @param right		The value on the right side of the operator
636:             *
637:             * @return	A BooleanDataValue telling the result of the comparison
638:             *
639:             * @exception StandardException		Thrown on error
640:             */
641:            public BooleanDataValue greaterThan(DataValueDescriptor left,
642:                    DataValueDescriptor right) throws StandardException;
643:
644:            /**
645:             * The SQL language <= operator.  This method is called from the language
646:             * module.  The storage module uses the compare method in Orderable.
647:             *
648:             * @param left		The value on the left side of the operator
649:             * @param right		The value on the right side of the operator
650:             *
651:             * @return	A BooleanDataValue telling the result of the comparison
652:             *
653:             * @exception StandardException		Thrown on error
654:             */
655:            public BooleanDataValue lessOrEquals(DataValueDescriptor left,
656:                    DataValueDescriptor right) throws StandardException;
657:
658:            /**
659:             * The SQL language >= operator.  This method is called from the language
660:             * module.  The storage module uses the compare method in Orderable.
661:             *
662:             * @param left		The value on the left side of the operator
663:             * @param right		The value on the right side of the operator
664:             *
665:             * @return	A BooleanDataValue telling the result of the comparison
666:             *
667:             * @exception StandardException		Thrown on error
668:             */
669:            public BooleanDataValue greaterOrEquals(DataValueDescriptor left,
670:                    DataValueDescriptor right) throws StandardException;
671:
672:            /**
673:             * The SQL language COALESCE/VALUE function.  This method is called from the language
674:             * module.  
675:             *
676:             * @param list		The list of the arguments. Function will return the first non-nullable argument if any.
677:             * @param returnValue		The return value is the correct datatype for this function.
678:             * The return value of this method is the type of the 2nd parameter.
679:             *
680:             * @return	A DataValueDescriptor which will be either null or first non-null argument
681:             *
682:             * @exception StandardException		Thrown on error
683:             */
684:            public DataValueDescriptor coalesce(DataValueDescriptor[] list,
685:                    DataValueDescriptor returnValue) throws StandardException;
686:
687:            /**
688:             * The SQL language IN operator.  This method is called from the language
689:             * module.  This method allows us to optimize and short circuit the search
690:             * if the list is ordered.
691:             *
692:             * @param left		The value on the left side of the operator
693:             * @param inList	The values in the IN list
694:             * @param orderedList	True means that the values in the IN list are ordered,
695:             *						false means they are not.
696:             *
697:             * @return	A BooleanDataValue telling the result of the comparison
698:             *
699:             * @exception StandardException		Thrown on error
700:             */
701:            public BooleanDataValue in(DataValueDescriptor left,
702:                    DataValueDescriptor[] inList, boolean orderedList)
703:                    throws StandardException;
704:
705:            /**
706:             * Compare this Orderable with a given Orderable for the purpose of
707:             * index positioning.  This method treats nulls as ordered values -
708:             * that is, it treats SQL null as equal to null and less than all
709:             * other values.
710:             *
711:             * @param other		The Orderable to compare this one to.
712:             *
713:             * @return  <0 - this Orderable is less than other.
714:             * 			 0 - this Orderable equals other.
715:             *			>0 - this Orderable is greater than other.
716:             *
717:             *			The code should not explicitly look for -1, or 1.
718:             *
719:             * @exception StandardException		Thrown on error
720:             */
721:            int compare(DataValueDescriptor other) throws StandardException;
722:
723:            /**
724:             * Compare this Orderable with a given Orderable for the purpose of
725:             * qualification and sorting.  The caller gets to determine how nulls
726:             * should be treated - they can either be ordered values or unknown
727:             * values.
728:             *
729:             * @param op	Orderable.ORDER_OP_EQUALS means do an = comparison.
730:             *				Orderable.ORDER_OP_LESSTHAN means compare this < other.
731:             *				Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
732:             * @param other	The DataValueDescriptor to compare this one to.
733:             * @param orderedNulls	True means to treat nulls as ordered values,
734:             *						that is, treat SQL null as equal to null, and less
735:             *						than all other values.
736:             *						False means to treat nulls as unknown values,
737:             *						that is, the result of any comparison with a null
738:             *						is the UNKNOWN truth value.
739:             * @param unknownRV		The return value to use if the result of the
740:             *						comparison is the UNKNOWN truth value.  In other
741:             *						words, if orderedNulls is false, and a null is
742:             *						involved in the comparison, return unknownRV.
743:             *						This parameter is not used orderedNulls is true.
744:             *
745:             * @return	true if the comparison is true (duh!)
746:             *
747:             * @exception StandardException		Thrown on error
748:             */
749:            boolean compare(int op, DataValueDescriptor other,
750:                    boolean orderedNulls, boolean unknownRV)
751:                    throws StandardException;
752:
753:            /**
754:            	Set the value to be the contents of the stream.
755:            	The reading of the stream may be delayed until execution time.
756:            	The format of the stream is required to be the format of this type.
757:
758:            	@param	theStream	stream of correctly formatted data
759:            	@param	valueLength	logical length of the stream's value in units of this type (e.g. chars for string types).
760:             */
761:            public void setValue(InputStream theStream, int valueLength)
762:                    throws StandardException;
763:
764:            /**
765:            	Check the value to seem if it conforms to the restrictions
766:            	imposed by DB2/JCC on host variables for this type.
767:
768:            	@exception StandardException Variable is too big.
769:             */
770:            public void checkHostVariable(int declaredLength)
771:                    throws StandardException;
772:
773:            /**
774:             * Estimate the memory usage in bytes of the data value and the overhead of the class.
775:             *
776:             * @return the estimated memory usage
777:             */
778:            int estimateMemoryUsage();
779:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.