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

All known Subclasses:   org.apache.derby.iapi.types.SQLBlob,  org.apache.derby.iapi.types.SQLBit,
SQLBinary
abstract class SQLBinary extends DataType implements BitDataValue(Code)
SQLBinary is the abstract class for the binary datatypes.
  • CHAR FOR BIT DATA
  • VARCHAR FOR BIT DATA
  • LONG VARCHAR
  • BLOB

Format :
Length is encoded to support Cloudscape 5.x databases where the length was stored as the number of bits. The first bit of the first byte indicates if the format is an old (Cloudscape 5.x) style or a new Derby style. Derby then uses the next two bits to indicate how the length is encoded.
is one of N styles.

  • (5.x format zero) 4 byte Java format integer value 0 - either is 0 bytes/bits or an unknown number of bytes.
  • (5.x format bits) 4 byte Java format integer value >0 (positive) - number of bits in , number of bytes in is the minimum number of bytes required to store the number of bits.
  • (Derby format) 1 byte encoded length (0 <= L <= 31) - number of bytes of - encoded = 0x80 & L
  • (Derby format) 3 byte encoded length (32 <= L < 64k) - number of bytes of - encoded = 0xA0
  • (Derby format) 5 byte encoded length (64k <= L < 2G) - number of bytes of - encoded = 0xC0
  • (future) to be determined L >= 2G - encoded 0xE0 (0xE0 is an esacape to allow any number of arbitary encodings in the future).

When the value was written from a byte array the Derby encoded byte length format was always used from Derby 10.0 onwards (ie. all open source versions).
When the value was written from a stream (e.g. PreparedStatement.setBinaryStream) then the Cloudscape '5.x format zero' was used by 10.0 and 10.1. The was due to the class RawToBinaryFormatStream always writing four zero bytes for the length before the data.
The Cloudscape '5.x format bits' format I think was never used by Derby.


Field Summary
final static  bytePAD
    
 byte[]dataValue
    
 InputStreamstream
     Value as a stream, this stream represents the on-disk format of the value.
 intstreamValueLength
     Length of the value in bytes when this value is set as a stream.

Constructor Summary
 SQLBinary()
     no-arg constructor, required by Formattable.
 SQLBinary(byte[] val)
    

Method Summary
final public  NumberDataValuecharLength(NumberDataValue result)
     This method implements the char_length function for bit.
final public  voidcheckHostVariable(int declaredLength)
     Host variables are rejected if their length is bigger than the declared length, regardless of if the trailing bytes are the pad character.
final public  ObjectcloneObject()
     From CloneableObject Shallow clone a StreamStorable without objectifying.
final public  booleancompare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV)
    
final public  intcompare(DataValueDescriptor other)
    
final public  BitDataValueconcatenate(BitDataValue left, BitDataValue right, BitDataValue result)
    
final public  BooleanDataValueequals(DataValueDescriptor left, DataValueDescriptor right)
     The = operator as called from the language module, as opposed to the storage module.
public  intestimateMemoryUsage()
    
final public  byte[]getBytes()
    
final public  DataValueDescriptorgetClone()
    
final public  intgetLength()
    
abstract  intgetMaxMemoryUsage()
    
final public  InputStreamgetStream()
    
final public  StringgetString()
     Used by JDBC -- string should not contain SQL92 formatting.
 byte[]getValue()
    
final public  BooleanDataValuegreaterOrEquals(DataValueDescriptor left, DataValueDescriptor right)
     The >= operator as called from the language module, as opposed to the storage module.
final public  BooleanDataValuegreaterThan(DataValueDescriptor left, DataValueDescriptor right)
     The > operator as called from the language module, as opposed to the storage module.
final public  inthashCode()
    
final public  booleanisNull()
     see if the Bit value is null.
final public  BooleanDataValuelessOrEquals(DataValueDescriptor left, DataValueDescriptor right)
     The <= operator as called from the language module, as opposed to the storage module.
final public  BooleanDataValuelessThan(DataValueDescriptor left, DataValueDescriptor right)
     The < operator as called from the language module, as opposed to the storage module.
final public  voidloadStream()
    
final public  BooleanDataValuenotEquals(DataValueDescriptor left, DataValueDescriptor right)
     The <> operator as called from the language module, as opposed to the storage module.
 booleanobjectNull(Object o)
    
final public  voidreadExternal(ObjectInput in)
    
final public  voidreadExternalFromArray(ArrayInputStream in)
    
final public  voidrestoreToNull()
    
final public  InputStreamreturnStream()
    
final 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.
final public  voidsetStream(InputStream newStream)
     Set me to the value represented by this stream. The format of the stream is the on-disk format described in this class's javadoc.
final public  voidsetValue(byte[] theValue)
    
final public  voidsetValue(InputStream theStream, int valueLength)
     Set the value from the stream which is in the on-disk format.
final public  ConcatableDataValuesubstring(NumberDataValue start, NumberDataValue length, ConcatableDataValue result, int maxLen)
     The SQL substr() function.
final public  StringtoString()
    
final public  voidwriteExternal(ObjectOutput out)
     Write the value out from the byte array (not called if null) using the 8.1 encoding.

Field Detail
PAD
final static byte PAD(Code)



dataValue
byte[] dataValue(Code)



stream
InputStream stream(Code)
Value as a stream, this stream represents the on-disk format of the value. That is it has length information encoded in the first fe bytes.



streamValueLength
int streamValueLength(Code)
Length of the value in bytes when this value is set as a stream. Represents the length of the value itself and not the length of the stream which contains this length encoded as the first few bytes. If the value of the stream is unknown then this will be set to -1. If this value is not set as a stream then this value should be ignored.




Constructor Detail
SQLBinary
SQLBinary()(Code)
no-arg constructor, required by Formattable.



SQLBinary
SQLBinary(byte[] val)(Code)




Method Detail
charLength
final public NumberDataValue charLength(NumberDataValue result) throws StandardException(Code)
This method implements the char_length function for bit.
Parameters:
  result - The result of a previous call to this method, nullif not called yet A SQLInteger containing the length of the char value
exception:
  StandardException - Thrown on error
See Also:   ConcatableDataValue.charLength



checkHostVariable
final public void checkHostVariable(int declaredLength) throws StandardException(Code)
Host variables are rejected if their length is bigger than the declared length, regardless of if the trailing bytes are the pad character.
exception:
  StandardException - Variable is too big.



cloneObject
final public Object cloneObject()(Code)
From CloneableObject Shallow clone a StreamStorable without objectifying. This is used to avoid unnecessary objectifying of a stream object. The only difference of this method from getClone is this method does not objectify a stream. beetle 4896



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

exception:
  StandardException - thrown on error



compare
final public int compare(DataValueDescriptor other) throws StandardException(Code)

exception:
  StandardException - thrown on error



concatenate
final public BitDataValue concatenate(BitDataValue left, BitDataValue right, BitDataValue result) throws StandardException(Code)

See Also:   BitDataValue.concatenate
exception:
  StandardException - Thrown on error



equals
final public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The = operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the =
Parameters:
  right - The value on the right side of the =is not. A SQL boolean value telling whether the two parameters are equal
exception:
  StandardException - Thrown on error



estimateMemoryUsage
public int estimateMemoryUsage()(Code)



getBytes
final public byte[] getBytes() throws StandardException(Code)

exception:
  StandardException - Thrown on error



getClone
final public DataValueDescriptor getClone()(Code)

See Also:   DataValueDescriptor.getClone
See Also:   



getLength
final public int getLength() throws StandardException(Code)
length in bytes
exception:
  StandardException - Thrown on error



getMaxMemoryUsage
abstract int getMaxMemoryUsage()(Code)
Return max memory usage for a SQL Binary



getStream
final public InputStream getStream()(Code)

exception:
  StandardException - Thrown on error



getString
final public String getString() throws StandardException(Code)
Used by JDBC -- string should not contain SQL92 formatting.
exception:
  StandardException - Thrown on error



getValue
byte[] getValue() throws StandardException(Code)



greaterOrEquals
final public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The >= operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the >=
Parameters:
  right - The value on the right side of the >= A SQL boolean value telling whether the first operand isgreater than or equal to the second operand
exception:
  StandardException - Thrown on error



greaterThan
final public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The > operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the >
Parameters:
  right - The value on the right side of the > A SQL boolean value telling whether the first operand isgreater than the second operand
exception:
  StandardException - Thrown on error



hashCode
final public int hashCode()(Code)



isNull
final public boolean isNull()(Code)
see if the Bit value is null.
See Also:   org.apache.derby.iapi.services.io.Storable.isNull



lessOrEquals
final public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The <= operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the <=
Parameters:
  right - The value on the right side of the <= A SQL boolean value telling whether the first operand isless than or equal to the second operand
exception:
  StandardException - Thrown on error



lessThan
final public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The < operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the <
Parameters:
  right - The value on the right side of the < A SQL boolean value telling whether the first operand isless than the second operand
exception:
  StandardException - Thrown on error



loadStream
final public void loadStream() throws StandardException(Code)



notEquals
final public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)
The <> operator as called from the language module, as opposed to the storage module.
Parameters:
  left - The value on the left side of the <>
Parameters:
  right - The value on the right side of the <> A SQL boolean value telling whether the two parametersare not equal
exception:
  StandardException - Thrown on error



objectNull
boolean objectNull(Object o)(Code)



readExternal
final public void readExternal(ObjectInput in) throws IOException(Code)
delegated to bit
exception:
  IOException - io exception
exception:
  ClassNotFoundException - class not found



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



restoreToNull
final public void restoreToNull()(Code)

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



returnStream
final public InputStream returnStream()(Code)



setFrom
final 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.



setStream
final public void setStream(InputStream newStream)(Code)
Set me to the value represented by this stream. The format of the stream is the on-disk format described in this class's javadoc. That is the length is encoded in the first few bytes of the stream.



setValue
final public void setValue(byte[] theValue)(Code)



setValue
final public void setValue(InputStream theStream, int valueLength)(Code)
Set the value from the stream which is in the on-disk format.
Parameters:
  theStream - On disk format of the stream
Parameters:
  valueLength - length of the logical value in bytes.



substring
final public ConcatableDataValue substring(NumberDataValue start, NumberDataValue length, ConcatableDataValue result, int maxLen) throws StandardException(Code)
The SQL substr() function.
Parameters:
  start - Start of substr
Parameters:
  length - Length of substr
Parameters:
  result - The result of a previous call to this method,null if not called yet.
Parameters:
  maxLen - Maximum length of the result A ConcatableDataValue containing the result of the substr()
exception:
  StandardException - Thrown on error



toString
final public String toString()(Code)



writeExternal
final public void writeExternal(ObjectOutput out) throws IOException(Code)
Write the value out from the byte array (not called if null) using the 8.1 encoding.
exception:
  IOException - io exception



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.