Java Doc for SQLTime.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.iapi.types.DataType
      org.apache.derby.iapi.types.SQLTime

SQLTime
final public class SQLTime extends DataType implements DateTimeDataValue(Code)
This contains an instance of a SQL Time Our current implementation doesn't implement time precision so the fractional seconds portion of the time is always 0. The default when no time precision is specified is 0 fractional seconds. A SQL Time without timezone information is assumed to be in the local time zone. The local time is stored as is and doesn't change if the timezone changes. This is in conformance with the SQL99 standard. The SQL92 standard indicates that the time is in GMT and changes with the timezone. The SQL99 standard clarifies this to allow time without timezoned to be stored as the local time.

Time is stored as two ints. The first int represents hour, minute, second and the second represents fractional seconds (currently 0 since we don't support time precision) encodedTime = -1 indicates null PERFORMANCE OPTIMIZATION: The java.sql.Time object is only instantiated on demand for performance reasons.



Field Summary
final static  charJIS_SEPARATOR
    

Constructor Summary
public  SQLTime()
    
public  SQLTime(Time value)
    
public  SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder)
     Construct a time from a string.
public  SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal)
     Construct a time from a string.

Method Summary
public  intcompare(DataValueDescriptor other)
    
public  booleancompare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV)
    
static  intcomputeEncodedTime(Calendar cal)
    
static  intcomputeEncodedTime(int hour, int minute, int second)
    
static  intcomputeEncodedTime(java.util.Date value, Calendar currentCal)
    
protected static  StringencodedTimeToString(int encodedTime)
     Get the String version from the encodedTime.
public  intestimateMemoryUsage()
    
public  DataValueDescriptorgetClone()
    
public  NumberDataValuegetDate(NumberDataValue result)
    
 intgetEncodedTime()
    
protected static  intgetHour(int encodedTime)
    
public  NumberDataValuegetHours(NumberDataValue result)
    
public  intgetLength()
    
protected static  intgetMinute(int encodedTime)
    
public  NumberDataValuegetMinutes(NumberDataValue result)
    
public  NumberDataValuegetMonth(NumberDataValue result)
    
protected  StringgetNationalString(LocaleFinder localeFinder)
     International version of getString().
public  DataValueDescriptorgetNewNull()
    
public  ObjectgetObject()
    
protected static  intgetSecond(int encodedTime)
    
public  NumberDataValuegetSeconds(NumberDataValue result)
    
public  StringgetString()
    
public  TimegetTime(java.util.Calendar cal)
     Get the time value Since this is a JDBC object we use the JDBC definition we use the JDBC definition, see JDBC API Tutorial and Reference section 47.3.12 Date is set to Jan.
public  TimestampgetTimestamp(Calendar cal)
     Convert a SQL TIME to a JDBC java.sql.Timestamp. Behaviour is to set the date portion of the Timestamp to the actual current date, which may not match the SQL CURRENT DATE, which remains fixed for the lifetime of a SQL statement.
public  intgetTypeFormatId()
     Return my format identifier.
public  StringgetTypeName()
    
public  NumberDataValuegetYear(NumberDataValue result)
    
public  inthashCode()
    
final public  booleanisNull()
     Check if the value is null.
public  voidreadExternal(ObjectInput in)
    
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidrestoreToNull()
    
protected  voidsetFrom(DataValueDescriptor theValue)
    
public  voidsetInto(PreparedStatement ps, int position)
     Adding this method to ensure that super class' setInto method doesn't get called that leads to the violation of JDBC spec( untyped nulls ) when batching is turned on.
 voidsetObject(Object theValue)
     Set the value from a correctly typed Time object.
public  voidsetValue(Time value, Calendar cal)
    
public  voidsetValue(Timestamp value, Calendar cal)
    
public  voidsetValue(String theValue)
    
public  voidsetValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable)
    
static  voidtimeToString(int hour, int minute, int second, StringBuffer sb)
    
public  DateTimeDataValuetimestampAdd(int intervalType, NumberDataValue intervalCount, java.sql.Date currentDate, DateTimeDataValue resultHolder)
     Add a number of intervals to a datetime value.
public  NumberDataValuetimestampDiff(int intervalType, DateTimeDataValue time1, java.sql.Date currentDate, NumberDataValue resultHolder)
     Finds the difference between two datetime values as a number of intervals.
public  StringtoString()
    
public  inttypePrecedence()
    
public  voidwriteExternal(ObjectOutput out)
    

Field Detail
JIS_SEPARATOR
final static char JIS_SEPARATOR(Code)




Constructor Detail
SQLTime
public SQLTime()(Code)
no-arg constructor required by Formattable



SQLTime
public SQLTime(Time value) throws StandardException(Code)



SQLTime
public SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder) throws StandardException(Code)
Construct a time from a string. The allowed time formats are:
  1. old ISO and IBM European standard: hh.mm[.ss]
  2. IBM USA standard: hh[:mm] {AM | PM}
  3. JIS & current ISO: hh:mm[:ss]

exception:
  Standard - exception if the syntax is invalid or the value is out of range.



SQLTime
public SQLTime(String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal) throws StandardException(Code)
Construct a time from a string. The allowed time formats are:
  1. old ISO and IBM European standard: hh.mm[.ss]
  2. IBM USA standard: hh[:mm] {AM | PM}
  3. JIS & current ISO: hh:mm[:ss]

exception:
  Standard - exception if the syntax is invalid or the value is out of range.




Method Detail
compare
public int compare(DataValueDescriptor other) throws StandardException(Code)
Orderable interface
See Also:   org.apache.derby.iapi.types.Orderable
exception:
  StandardException - thrown on failure



compare
public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)

exception:
  StandardException - thrown on error



computeEncodedTime
static int computeEncodedTime(Calendar cal) throws StandardException(Code)
Calculate the encoded time from a Calendar object encoded time is hour << 16 + min << 8 + sec this function is also used by SQLTimestamp
Parameters:
  cal - calendar with time set encoded time
exception:
  StandardException - if the time is not in the DB2 range



computeEncodedTime
static int computeEncodedTime(int hour, int minute, int second) throws StandardException(Code)



computeEncodedTime
static int computeEncodedTime(java.util.Date value, Calendar currentCal) throws StandardException(Code)



encodedTimeToString
protected static String encodedTimeToString(int encodedTime)(Code)
Get the String version from the encodedTime. string value.



estimateMemoryUsage
public int estimateMemoryUsage()(Code)



getClone
public DataValueDescriptor getClone()(Code)

See Also:   DataValueDescriptor.getClone
See Also:   



getDate
public NumberDataValue getDate(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getDate
exception:
  StandardException - Thrown on error



getEncodedTime
int getEncodedTime()(Code)



getHour
protected static int getHour(int encodedTime)(Code)
Get the encoded hour value (may be different than hour value for current timezone if value encoded in a different timezone) hour value



getHours
public NumberDataValue getHours(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getHours
exception:
  StandardException - Thrown on error



getLength
public int getLength()(Code)



getMinute
protected static int getMinute(int encodedTime)(Code)
Get the encoded minute value (may be different than the minute value for current timezone if value encoded in a different timezone) minute value



getMinutes
public NumberDataValue getMinutes(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getMinutes
exception:
  StandardException - Thrown on error



getMonth
public NumberDataValue getMonth(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getMonth
exception:
  StandardException - Thrown on error



getNationalString
protected String getNationalString(LocaleFinder localeFinder) throws StandardException(Code)
International version of getString(). Overrides getNationalString in DataType for date, time, and timestamp.
exception:
  StandardException - Thrown on error



getNewNull
public DataValueDescriptor getNewNull()(Code)

See Also:   DataValueDescriptor.getNewNull



getObject
public Object getObject()(Code)



getSecond
protected static int getSecond(int encodedTime)(Code)
Get the encoded second value (may be different than the second value for current timezone if value encoded in a different timezone) second value



getSeconds
public NumberDataValue getSeconds(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getSeconds
exception:
  StandardException - Thrown on error



getString
public String getString()(Code)



getTime
public Time getTime(java.util.Calendar cal)(Code)
Get the time value Since this is a JDBC object we use the JDBC definition we use the JDBC definition, see JDBC API Tutorial and Reference section 47.3.12 Date is set to Jan. 1, 1970 The localized time value.



getTimestamp
public Timestamp getTimestamp(Calendar cal)(Code)
Convert a SQL TIME to a JDBC java.sql.Timestamp. Behaviour is to set the date portion of the Timestamp to the actual current date, which may not match the SQL CURRENT DATE, which remains fixed for the lifetime of a SQL statement. JDBC drivers (especially network client drivers) could not be expected to fetch the CURRENT_DATE SQL value on every query that involved a TIME value, so the current date as seen by the JDBC client was picked as the logical behaviour. See DERBY-1811.



getTypeFormatId
public int getTypeFormatId()(Code)
Return my format identifier.
See Also:   org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId



getTypeName
public String getTypeName()(Code)



getYear
public NumberDataValue getYear(NumberDataValue result) throws StandardException(Code)

See Also:   DateTimeDataValue.getYear
exception:
  StandardException - Thrown on error



hashCode
public int hashCode()(Code)



isNull
final public boolean isNull()(Code)
Check if the value is null. Whether or not value is logically null.



readExternal
public void readExternal(ObjectInput in) throws IOException(Code)

See Also:   java.io.Externalizable.readExternal
exception:
  IOException - Thrown on error reading the object



readExternalFromArray
public void readExternalFromArray(ArrayInputStream in) throws IOException(Code)



restoreToNull
public void restoreToNull()(Code)

See Also:   org.apache.derby.iapi.services.io.Storable.restoreToNull



setFrom
protected void setFrom(DataValueDescriptor theValue) throws StandardException(Code)



setInto
public void setInto(PreparedStatement ps, int position) throws SQLException, StandardException(Code)
Adding this method to ensure that super class' setInto method doesn't get called that leads to the violation of JDBC spec( untyped nulls ) when batching is turned on.



setObject
void setObject(Object theValue) throws StandardException(Code)
Set the value from a correctly typed Time object.
throws:
  StandardException -



setValue
public void setValue(Time value, Calendar cal) throws StandardException(Code)

See Also:   DateTimeDataValue.setValue
exception:
  StandardException - thrown on failure.



setValue
public void setValue(Timestamp value, Calendar cal) throws StandardException(Code)

See Also:   DateTimeDataValue.setValue
exception:
  StandardException - thrown on failure.



setValue
public void setValue(String theValue) throws StandardException(Code)



setValueFromResultSet
public void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) throws SQLException, StandardException(Code)

See Also:   DataValueDescriptor.setValueFromResultSet
See Also:   
exception:
  SQLException - Thrown on error



timeToString
static void timeToString(int hour, int minute, int second, StringBuffer sb)(Code)
Convert a time to a JDBC escape format string
Parameters:
  hour -
Parameters:
  minute -
Parameters:
  second -
Parameters:
  sb - The resulting string is appended to this StringBuffer



timestampAdd
public DateTimeDataValue timestampAdd(int intervalType, NumberDataValue intervalCount, java.sql.Date currentDate, DateTimeDataValue resultHolder) throws StandardException(Code)
Add a number of intervals to a datetime value. Implements the JDBC escape TIMESTAMPADD function.
Parameters:
  intervalType - One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL
Parameters:
  intervalCount - The number of intervals to add
Parameters:
  currentDate - Used to convert time to timestamp
Parameters:
  resultHolder - If non-null a DateTimeDataValue that can be used to hold the result. If null thengenerate a new holder startTime + intervalCount intervals, as a timestamp
exception:
  StandardException -



timestampDiff
public NumberDataValue timestampDiff(int intervalType, DateTimeDataValue time1, java.sql.Date currentDate, NumberDataValue resultHolder) throws StandardException(Code)
Finds the difference between two datetime values as a number of intervals. Implements the JDBC TIMESTAMPDIFF escape function.
Parameters:
  intervalType - One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL
Parameters:
  time1 -
Parameters:
  currentDate - Used to convert time to timestamp
Parameters:
  resultHolder - If non-null a NumberDataValue that can be used to hold the result. If null thengenerate a new holder the number of intervals by which this datetime is greater than time1
exception:
  StandardException -



toString
public String toString()(Code)



typePrecedence
public int typePrecedence()(Code)

See Also:   DataValueDescriptor.typePrecedence
See Also:   



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)

exception:
  IOException - error writing data



Methods inherited from org.apache.derby.iapi.types.DataType
public void checkHostVariable(int declaredLength) throws StandardException(Code)(Java Doc)
public Object cloneObject()(Code)(Java Doc)
public DataValueDescriptor coalesce(DataValueDescriptor[] argumentsList, DataValueDescriptor returnValue) throws StandardException(Code)(Java Doc)
public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)(Java Doc)
final protected StandardException dataTypeConversion(String targetType)(Code)(Java Doc)
public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public boolean equals(Object other)(Code)(Java Doc)
protected static int flip(int operator)(Code)(Java Doc)
void genericSetObject(Object theValue) throws StandardException(Code)(Java Doc)
public boolean getBoolean() throws StandardException(Code)(Java Doc)
public byte getByte() throws StandardException(Code)(Java Doc)
public byte[] getBytes() throws StandardException(Code)(Java Doc)
public Date getDate(Calendar cal) throws StandardException(Code)(Java Doc)
public double getDouble() throws StandardException(Code)(Java Doc)
public float getFloat() throws StandardException(Code)(Java Doc)
public int getInt() throws StandardException(Code)(Java Doc)
public long getLong() throws StandardException(Code)(Java Doc)
protected String getNationalString(LocaleFinder localeFinder) throws StandardException(Code)(Java Doc)
public Object getObject() throws StandardException(Code)(Java Doc)
public short getShort() throws StandardException(Code)(Java Doc)
public InputStream getStream() throws StandardException(Code)(Java Doc)
public Time getTime(Calendar cal) throws StandardException(Code)(Java Doc)
public Timestamp getTimestamp(Calendar cal) throws StandardException(Code)(Java Doc)
public String getTraceString() throws StandardException(Code)(Java Doc)
String getTypeName(String className)(Code)(Java Doc)
public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue in(DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException(Code)(Java Doc)
final protected StandardException invalidFormat()(Code)(Java Doc)
final public BooleanDataValue isNotNull()(Code)(Java Doc)
final public BooleanDataValue isNullOp()(Code)(Java Doc)
public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException(Code)(Java Doc)
public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc)
final protected StandardException outOfRange()(Code)(Java Doc)
public void setBigDecimal(Number bigDecimal) throws StandardException(Code)(Java Doc)
protected void setFrom(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc)
public void setInto(PreparedStatement ps, int position) throws SQLException, StandardException(Code)(Java Doc)
public void setInto(ResultSet rs, int position) throws SQLException, StandardException(Code)(Java Doc)
void setObject(Object theValue) throws StandardException(Code)(Java Doc)
public void setObjectForCast(Object theValue, boolean instanceOfResultType, String resultTypeClassName) throws StandardException(Code)(Java Doc)
public void setToNull()(Code)(Java Doc)
public void setValue(Time theValue) throws StandardException(Code)(Java Doc)
public void setValue(Time theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(Timestamp theValue) throws StandardException(Code)(Java Doc)
public void setValue(Timestamp theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(Date theValue) throws StandardException(Code)(Java Doc)
public void setValue(Date theValue, Calendar cal) throws StandardException(Code)(Java Doc)
public void setValue(String theValue) throws StandardException(Code)(Java Doc)
public void setValue(int theValue) throws StandardException(Code)(Java Doc)
public void setValue(double theValue) throws StandardException(Code)(Java Doc)
public void setValue(float theValue) throws StandardException(Code)(Java Doc)
public void setValue(short theValue) throws StandardException(Code)(Java Doc)
public void setValue(long theValue) throws StandardException(Code)(Java Doc)
public void setValue(byte theValue) throws StandardException(Code)(Java Doc)
public void setValue(boolean theValue) throws StandardException(Code)(Java Doc)
public void setValue(byte[] theValue) throws StandardException(Code)(Java Doc)
final public void setValue(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc)
public void setValue(InputStream theStream, int valueLength) throws StandardException(Code)(Java Doc)
public void throwLangSetMismatch(Object value) throws StandardException(Code)(Java Doc)
void throwLangSetMismatch(String argTypeName) throws StandardException(Code)(Java Doc)
public int typePrecedence()(Code)(Java Doc)
public int typeToBigDecimal() throws StandardException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.