Java Doc for SQLTimestamp.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.SQLTimestamp

SQLTimestamp
final public class SQLTimestamp extends DataType implements DateTimeDataValue(Code)
This contains an instance of a SQL Timestamp object.

SQLTimestamp is stored in 3 ints - an encoded date, an encoded time and nanoseconds encodedDate = 0 indicates a null WSCTimestamp SQLTimestamp is similar to SQLTimestamp, but it does conserves space by not keeping a GregorianCalendar object PERFORMANCE OPTIMIZATION: We only instantiate the value field when required due to the overhead of the Date methods. Thus, use isNull() instead of "value == null" and getTimestamp() instead of using value directly.



Field Summary
final static  charDATE_SEPARATOR
    
final static  intFRACTION_TO_NANO
    
final static  intMAX_FRACTION_DIGITS
    
final static  intONE_BILLION
    

Constructor Summary
public  SQLTimestamp()
    
public  SQLTimestamp(Timestamp value)
    
 SQLTimestamp(int encodedDate, int encodedTime, int nanos)
    
public  SQLTimestamp(DataValueDescriptor date, DataValueDescriptor time)
    
public  SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder)
     Construct a timestamp from a string.
public  SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder, Calendar cal)
     Construct a timestamp from a string.

Method Summary
public  intcompare(DataValueDescriptor other)
    
public  booleancompare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV)
    
public static  DateTimeDataValuecomputeTimestampFunction(DataValueDescriptor operand, DataValueFactory dvf)
     Compute the SQL timestamp function.
public  intestimateMemoryUsage()
    
public  DataValueDescriptorgetClone()
    
public  DategetDate(Calendar cal)
     getDate returns the date portion of the timestamp Time is set to 00:00:00.0 Since Date is a JDBC object we use the JDBC definition for the time portion.
public  NumberDataValuegetDate(NumberDataValue result)
    
public  NumberDataValuegetHours(NumberDataValue result)
    
public  intgetLength()
    
public  NumberDataValuegetMinutes(NumberDataValue result)
    
public  NumberDataValuegetMonth(NumberDataValue result)
    
protected  StringgetNationalString(LocaleFinder localeFinder)
     International version of getString().
public  DataValueDescriptorgetNewNull()
    
public  ObjectgetObject()
    
public  NumberDataValuegetSeconds(NumberDataValue source)
    
public  StringgetString()
    
public  TimegetTime(Calendar cal)
     getTime returns the time portion of the timestamp Date is set to 1970-01-01 Since Time is a JDBC object we use the JDBC definition for the date portion.
public  TimestampgetTimestamp(java.util.Calendar cal)
     Get the value field.
public  intgetTypeFormatId()
     Return my format identifier.
public  StringgetTypeName()
    
public  NumberDataValuegetYear(NumberDataValue result)
    
public  inthashCode()
    
final public  booleanisNull()
     Check if the value is null.
static  int[]parseDateOrTimestamp(DateTimeParser parser, boolean timeRequired)
     Parse a timestamp or a date.
static  intparseDateTimeInteger(String str, int start, int ndigits)
    
static  int[]parseLocalTimestamp(String str, LocaleFinder localeFinder, Calendar cal)
     Parse a localized timestamp.
static  SQLTimestamppromote(DateTimeDataValue dateTime, java.sql.Date currentDate)
     Promotes a DateTimeDataValue to a timestamp.
public  voidreadExternal(ObjectInput in)
    
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidrestoreToNull()
    
protected  voidsetFrom(DataValueDescriptor theValue)
    
public  voidsetInto(PreparedStatement ps, int position)
    
 voidsetObject(Object theValue)
     Set the value from a correctly typed Timestamp object.
public  voidsetValue(Date value, Calendar cal)
    
public  voidsetValue(Time value, Calendar cal)
    
public  voidsetValue(Timestamp value, Calendar cal)
    
public  voidsetValue(String theValue)
    
public  voidsetValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable)
    
public  DateTimeDataValuetimestampAdd(int intervalType, NumberDataValue count, 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
DATE_SEPARATOR
final static char DATE_SEPARATOR(Code)



FRACTION_TO_NANO
final static int FRACTION_TO_NANO(Code)



MAX_FRACTION_DIGITS
final static int MAX_FRACTION_DIGITS(Code)



ONE_BILLION
final static int ONE_BILLION(Code)




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



SQLTimestamp
public SQLTimestamp(Timestamp value) throws StandardException(Code)



SQLTimestamp
SQLTimestamp(int encodedDate, int encodedTime, int nanos)(Code)



SQLTimestamp
public SQLTimestamp(DataValueDescriptor date, DataValueDescriptor time) throws StandardException(Code)



SQLTimestamp
public SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder) throws StandardException(Code)
Construct a timestamp from a string. The allowed formats are:
  1. JDBC escape: yyyy-mm-dd hh:mm:ss[.fffff]
  2. IBM: yyyy-mm-dd-hh.mm.ss[.nnnnnn]
The format is specified by a parameter to the constructor. Leading zeroes may be omitted from the month, day, and hour part of the timestamp. The microsecond part may be omitted or truncated.



SQLTimestamp
public SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder, Calendar cal) throws StandardException(Code)
Construct a timestamp from a string. The allowed formats are:
  1. JDBC escape: yyyy-mm-dd hh:mm:ss[.fffff]
  2. IBM: yyyy-mm-dd-hh.mm.ss[.nnnnnn]
The format is specified by a parameter to the constructor. Leading zeroes may be omitted from the month, day, and hour part of the timestamp. The microsecond part may be omitted or truncated.




Method Detail
compare
public int compare(DataValueDescriptor other) throws StandardException(Code)



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

exception:
  StandardException - thrown on error



computeTimestampFunction
public static DateTimeDataValue computeTimestampFunction(DataValueDescriptor operand, DataValueFactory dvf) throws StandardException(Code)
Compute the SQL timestamp function.
exception:
  StandardException -



estimateMemoryUsage
public int estimateMemoryUsage()(Code)



getClone
public DataValueDescriptor getClone()(Code)

See Also:   DataValueDescriptor.getClone
See Also:   



getDate
public Date getDate(Calendar cal) throws StandardException(Code)
getDate returns the date portion of the timestamp Time is set to 00:00:00.0 Since Date is a JDBC object we use the JDBC definition for the time portion. See JDBC API Tutorial, 47.3.12.
exception:
  StandardException - thrown on failure



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

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



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

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



getLength
public int getLength()(Code)



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)



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

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



getString
public String getString()(Code)



getTime
public Time getTime(Calendar cal) throws StandardException(Code)
getTime returns the time portion of the timestamp Date is set to 1970-01-01 Since Time is a JDBC object we use the JDBC definition for the date portion. See JDBC API Tutorial, 47.3.12.
exception:
  StandardException - thrown on failure



getTimestamp
public Timestamp getTimestamp(java.util.Calendar cal)(Code)
Get the value field. We instantiate the field on demand. The value field.



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. encodedDate value of 0 is null Whether or not value is logically null.



parseDateOrTimestamp
static int[] parseDateOrTimestamp(DateTimeParser parser, boolean timeRequired) throws StandardException(Code)
Parse a timestamp or a date. DB2 allows timestamps to be used as dates or times. So date('2004-04-15-16.15.32') is valid, as is date('2004-04-15'). This method does not handle localized timestamps.
Parameters:
  parser - a DateTimeParser initialized with a string.
Parameters:
  timeRequired - If true then an error will be thrown if the time is missing. If false then the time maybe omitted. {encodedDate, encodedTime, nanosecond} array.
exception:
  StandardException - if the syntax is incorrect for an IBM standard timestamp.



parseDateTimeInteger
static int parseDateTimeInteger(String str, int start, int ndigits) throws StandardException(Code)



parseLocalTimestamp
static int[] parseLocalTimestamp(String str, LocaleFinder localeFinder, Calendar cal) throws StandardException, ParseException(Code)
Parse a localized timestamp.
Parameters:
  str - the timestamp string, with trailing blanks removed.
Parameters:
  localeFinder - a {encodedDate, encodedTime} array.
exception:
  ParseException - If the string is not a valid timestamp.



promote
static SQLTimestamp promote(DateTimeDataValue dateTime, java.sql.Date currentDate) throws StandardException(Code)
Promotes a DateTimeDataValue to a timestamp. the corresponding timestamp, using the current date if datetime is a time,or time 00:00:00 if datetime is a date.
exception:
  StandardException -



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)



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



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

See Also:   DateTimeDataValue.setValue
See Also:   When converting from a date to a timestamp, time is set to 00:00:00.0



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

See Also:   DateTimeDataValue.setValue



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

See Also:   DateTimeDataValue.setValue



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



timestampAdd
public DateTimeDataValue timestampAdd(int intervalType, NumberDataValue count, 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:
  count - 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.