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

SQLDate
final public class SQLDate extends DataType implements DateTimeDataValue(Code)
This contains an instance of a SQL Date.

The date is stored as int (year << 16 + month << 8 + day) Null is represented by an encodedDate value of 0. Some of the static methods in this class are also used by SQLTime and SQLTimestamp so check those classes if you change the date encoding PERFORMANCE OPTIMIZATION: The java.sql.Date object is only instantiated when needed do to the overhead of Date.valueOf(), etc. methods.



Field Summary
final static  charISO_SEPARATOR
    

Constructor Summary
public  SQLDate()
    
public  SQLDate(Date value)
    
public  SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder)
     Construct a date from a string.
public  SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal)
     Construct a date from a string.

Method Summary
public  intcompare(DataValueDescriptor other)
    
public  booleancompare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV)
    
public static  DateTimeDataValuecomputeDateFunction(DataValueDescriptor operand, DataValueFactory dvf)
     Implement the date SQL function: construct a SQL date from a string, number, or timestamp.
static  intcomputeEncodedDate(Calendar cal)
    
static  intcomputeEncodedDate(int y, int m, int d)
    
static  intcomputeEncodedDate(java.util.Date value, Calendar currentCal)
    
static  voiddateToString(int year, int month, int day, StringBuffer sb)
     Convert a date to the JDBC representation and append it to a string buffer.
static  StringencodedDateToString(int encodedDate)
     Get the String version from the encodedDate.
public  intestimateMemoryUsage()
    
public  DataValueDescriptorgetClone()
    
public  NumberDataValuegetDate(NumberDataValue result)
    
public  DategetDate(Calendar cal)
     Get the value field.
static  intgetDay(int encodedDate)
     Get the day from the encodedDate.
 intgetEncodedDate()
    
public  NumberDataValuegetHours(NumberDataValue result)
    
public  intgetLength()
    
public  NumberDataValuegetMinutes(NumberDataValue result)
    
public  NumberDataValuegetMonth(NumberDataValue result)
    
static  intgetMonth(int encodedDate)
     Get the month from the encodedDate.
protected  StringgetNationalString(LocaleFinder localeFinder)
     International version of getString().
public  DataValueDescriptorgetNewNull()
    
public  ObjectgetObject()
    
public  NumberDataValuegetSeconds(NumberDataValue result)
    
public  StringgetString()
    
public  TimestampgetTimestamp(Calendar cal)
    
public  intgetTypeFormatId()
     Return my format identifier.
public  StringgetTypeName()
    
public  NumberDataValuegetYear(NumberDataValue result)
    
static  intgetYear(int encodedDate)
     Get the year from the encodedDate.
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 Date object.
static  NumberDataValuesetSource(int value, NumberDataValue source)
     This helper routine tests the nullability of various parameters and sets up the result appropriately. If source is null, a new NumberDataValue is built.
public  voidsetValue(Date 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 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
ISO_SEPARATOR
final static char ISO_SEPARATOR(Code)




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



SQLDate
public SQLDate(Date value) throws StandardException(Code)



SQLDate
public SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder) throws StandardException(Code)
Construct a date from a string. The allowed date formats are:
  1. ISO: yyyy-mm-dd
  2. IBM USA standard: mm/dd/yyyy
  3. IBM European standard: dd.mm.yyyy
Trailing blanks may be included; leading zeros may be omitted from the month and day portions.
Parameters:
  dateStr -
Parameters:
  isJdbcEscape - if true then only the JDBC date escape syntax is allowed
Parameters:
  localeFinder -
exception:
  Standard - exception if the syntax is invalid or the value is out of range.



SQLDate
public SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal) throws StandardException(Code)
Construct a date from a string. The allowed date formats are:
  1. ISO: yyyy-mm-dd
  2. IBM USA standard: mm/dd/yyyy
  3. IBM European standard: dd.mm.yyyy
Trailing blanks may be included; leading zeros may be omitted from the month and day portions.
Parameters:
  dateStr -
Parameters:
  isJdbcEscape - if true then only the JDBC date escape syntax is allowed
Parameters:
  localeFinder -
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



computeDateFunction
public static DateTimeDataValue computeDateFunction(DataValueDescriptor operand, DataValueFactory dvf) throws StandardException(Code)
Implement the date SQL function: construct a SQL date from a string, number, or timestamp.
Parameters:
  operand - Must be a date or a string convertible to a date.
Parameters:
  dvf - the DataValueFactory
exception:
  StandardException - standard error policy



computeEncodedDate
static int computeEncodedDate(Calendar cal) throws StandardException(Code)
computeEncodedDate extracts the year, month and date from a Calendar value and encodes them as year << 16 + month << 8 + date Use this function will help to remember to add 1 to month which is 0 based in the Calendar class
Parameters:
  cal - the Calendar the encodedDate
exception:
  StandardException - if the value is out of the DB2 date range



computeEncodedDate
static int computeEncodedDate(int y, int m, int d) throws StandardException(Code)



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



dateToString
static void dateToString(int year, int month, int day, StringBuffer sb)(Code)
Convert a date to the JDBC representation and append it to a string buffer.
Parameters:
  year -
Parameters:
  month - 1 based (January == 1)
Parameters:
  day -
Parameters:
  sb - The string representation is appended to this StringBuffer



encodedDateToString
static String encodedDateToString(int encodedDate)(Code)
Get the String version from the encodedDate. 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



getDate
public Date getDate(Calendar cal)(Code)
Get the value field. We instantiate the field on demand. The value field.



getDay
static int getDay(int encodedDate)(Code)
Get the day from the encodedDate.
Parameters:
  encodedDate - the encoded date day value.



getEncodedDate
int getEncodedDate()(Code)



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



getMonth
static int getMonth(int encodedDate)(Code)
Get the month from the encodedDate.
Parameters:
  encodedDate - the encoded date month value.



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)
getObject returns the date value



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

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



getString
public String getString()(Code)



getTimestamp
public Timestamp getTimestamp(Calendar cal)(Code)
getTimestamp returns a timestamp with the date value time is set to 00:00:00.0



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



getYear
static int getYear(int encodedDate)(Code)
Get the year from the encodedDate.
Parameters:
  encodedDate - the encoded date year value.



hashCode
public int hashCode()(Code)



isNull
final public boolean isNull()(Code)
Check if the value is null. encodedDate is 0 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 Date object.
throws:
  StandardException -



setSource
static NumberDataValue setSource(int value, NumberDataValue source) throws StandardException(Code)
This helper routine tests the nullability of various parameters and sets up the result appropriately. If source is null, a new NumberDataValue is built.
exception:
  StandardException - Thrown on error



setValue
public void setValue(Date 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 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.