Package org.apache.derby.impl.jdbc
Class LOBStoredProcedure
- java.lang.Object
-
- org.apache.derby.impl.jdbc.LOBStoredProcedure
-
public class LOBStoredProcedure extends java.lang.ObjectContains the stored procedures that will be used in the LOB client side methods.
-
-
Constructor Summary
Constructors Constructor Description LOBStoredProcedure()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intBLOBCREATELOCATOR()Creates a new empty Blob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Blob.static byte[]BLOBGETBYTES(int LOCATOR, long pos, int len)Reads up to len bytes from the associatedBloband returns a byte array containing the bytes read.static longBLOBGETLENGTH(int LOCATOR)Returns the length in bytes of the Blob.static longBLOBGETPOSITIONFROMBYTES(int LOCATOR, byte[] searchBytes, long pos)Returns the first occurrence of the byte array in the Blob.static longBLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long pos)Returns the first occurrence of locator in the Blob.static voidBLOBRELEASELOCATOR(int LOCATOR)Removes the supplied LOCATOR entry from the hash map.static voidBLOBSETBYTES(int LOCATOR, long pos, int len, byte[] replaceBytes)Replaces the bytes at pos with len bytesstatic voidBLOBTRUNCATE(int LOCATOR, long length)truncates the Blob value represented by LOCATOR to have a length of length.static intCLOBCREATELOCATOR()Creates a new empty Clob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Clob.static longCLOBGETLENGTH(int LOCATOR)returns the length of the Clob corresponding to the LOCATOR value.static longCLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long fromPosition)returns the first occurrence of the given search string from the given start search position inside the Clob.static longCLOBGETPOSITIONFROMSTRING(int LOCATOR, java.lang.String searchLiteral, long fromPosition)returns the first occurrence of the given search string from the given start search position inside the Clob.static java.lang.StringCLOBGETSUBSTRING(int LOCATOR, long pos, int len)Returns theStringstarting fromposand consisting of up tolenconsecutive characters from theClobcorresponding toLOCATOR.static voidCLOBRELEASELOCATOR(int LOCATOR)Removes the supplied LOCATOR entry from the hash map.static voidCLOBSETSTRING(int LOCATOR, long pos, int length, java.lang.String str)replaces the characters starting at fromPosition and with length ForLengthstatic voidCLOBTRUNCATE(int LOCATOR, long length)truncates the Clob value represented by LOCATOR to have a length of length.private static java.sql.BlobgetBlobObjectCorrespondingtoLOCATOR(int LOCATOR)returns the Blob object corresponding to the locator.private static java.sql.ClobgetClobObjectCorrespondingtoLOCATOR(int LOCATOR)returns the Clob object corresponding to the locator.private static EmbedConnectiongetEmbedConnection()Returns the EmbedConnection object.private static java.sql.SQLExceptionnewSQLException(java.lang.String messageId)Generate the SQLException with the appropriate SQLState.
-
-
-
Method Detail
-
CLOBCREATELOCATOR
public static int CLOBCREATELOCATOR() throws java.sql.SQLExceptionCreates a new empty Clob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Clob.- Returns:
- an integer that maps to the Clob value created.
- Throws:
java.sql.SQLException
-
CLOBRELEASELOCATOR
public static void CLOBRELEASELOCATOR(int LOCATOR) throws java.sql.SQLExceptionRemoves the supplied LOCATOR entry from the hash map.- Parameters:
LOCATOR- an integer that represents the locator that needs to be removed from the hash map.- Throws:
java.sql.SQLException
-
CLOBGETPOSITIONFROMSTRING
public static long CLOBGETPOSITIONFROMSTRING(int LOCATOR, java.lang.String searchLiteral, long fromPosition) throws java.sql.SQLExceptionreturns the first occurrence of the given search string from the given start search position inside the Clob.- Parameters:
LOCATOR- an integer that represents the locator of the Clob in which the given position of the given sub-string needs to be found.searchLiteral- a String whose occurence inside the Clob needs to be found starting from pos.fromPosition- an integer that represents the position inside the Clob from which the search needs to begin.- Returns:
- an integer that represents the position inside the Clob of the first occurrence of the sub-string from the given starting position.
- Throws:
java.sql.SQLException
-
CLOBGETPOSITIONFROMLOCATOR
public static long CLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long fromPosition) throws java.sql.SQLExceptionreturns the first occurrence of the given search string from the given start search position inside the Clob.- Parameters:
LOCATOR- an integer that represents the locator of the Clob in which the given position of the given sub-string needs to be found.searchLocator- a Locator representing a Clob whose occurence inside the Clob needs to be found starting from pos.fromPosition- an integer that represents the position inside the Clob from which the search needs to begin.- Returns:
- an integer that represents the position inside the Clob of the first occurrence of the sub-string from the given starting position.
- Throws:
java.sql.SQLException
-
CLOBGETLENGTH
public static long CLOBGETLENGTH(int LOCATOR) throws java.sql.SQLExceptionreturns the length of the Clob corresponding to the LOCATOR value.- Parameters:
LOCATOR- an integer that represents the locator of the Clob whose length needs to be obtained.- Returns:
- an integer that represents the length of the Clob.
- Throws:
java.sql.SQLException
-
CLOBGETSUBSTRING
public static java.lang.String CLOBGETSUBSTRING(int LOCATOR, long pos, int len) throws java.sql.SQLExceptionReturns theStringstarting fromposand consisting of up tolenconsecutive characters from theClobcorresponding toLOCATOR.- Parameters:
LOCATOR- an integer that represents the LOCATOR used to retrieve an instance of the LOB.pos- a long that represents the position from which the substring begins.len- an integer representing the maximum length of the substring. The value will be reduced to the maximum allowed return length if required (seeLimits.MAX_CLOB_RETURN_LEN).- Returns:
- A substring from the
Clobstarting at the given position, not longer thanlencharacters. - Throws:
java.sql.SQLException
-
CLOBSETSTRING
public static void CLOBSETSTRING(int LOCATOR, long pos, int length, java.lang.String str) throws java.sql.SQLExceptionreplaces the characters starting at fromPosition and with length ForLength- Parameters:
LOCATOR- an integer that represents the locator of the Clob in which the characters need to be replaced.pos- an integer that represents the position inside the Clob from which the string needs to be replaced.length- the number of characters from the string that need to be used for replacement.str- the string from which the repalcement characters are built.- Throws:
java.sql.SQLException
-
CLOBTRUNCATE
public static void CLOBTRUNCATE(int LOCATOR, long length) throws java.sql.SQLExceptiontruncates the Clob value represented by LOCATOR to have a length of length.- Parameters:
LOCATOR- an integer that represents the LOCATOR used to retrieve an instance of the LOB.length- an integer that represents the length to which the Clob must be truncated to.- Throws:
java.sql.SQLException
-
getClobObjectCorrespondingtoLOCATOR
private static java.sql.Clob getClobObjectCorrespondingtoLOCATOR(int LOCATOR) throws java.sql.SQLExceptionreturns the Clob object corresponding to the locator.- Parameters:
LOCATOR- an integer that represents the locator corresponding to the Clob object requested.- Returns:
- a Clob object that is mapped to the LOCATOR object passed in.
- Throws:
a- SQLException.java.sql.SQLException
-
BLOBCREATELOCATOR
public static int BLOBCREATELOCATOR() throws java.sql.SQLExceptionCreates a new empty Blob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Blob.- Returns:
- an integer that maps to the Blob value created.
- Throws:
java.sql.SQLException
-
BLOBRELEASELOCATOR
public static void BLOBRELEASELOCATOR(int LOCATOR) throws java.sql.SQLExceptionRemoves the supplied LOCATOR entry from the hash map.- Parameters:
LOCATOR- an integer that represents the locator that needs to be removed from the hash map.- Throws:
java.sql.SQLException
-
BLOBGETPOSITIONFROMLOCATOR
public static long BLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long pos) throws java.sql.SQLExceptionReturns the first occurrence of locator in the Blob.- Parameters:
LOCATOR- the locator value of the Blob in which the seaching needs to be done.searchLocator- the locator value of the Blob whose position needs needs to be found.pos- the position from which the seaching needs to be done.- Returns:
- the position at which the first occurrence of the Blob is found.
- Throws:
java.sql.SQLException
-
BLOBGETPOSITIONFROMBYTES
public static long BLOBGETPOSITIONFROMBYTES(int LOCATOR, byte[] searchBytes, long pos) throws java.sql.SQLExceptionReturns the first occurrence of the byte array in the Blob.- Parameters:
LOCATOR- the locator value of the Blob in which the seaching needs to be done.searchBytes- the byte array whose position needs needs to be found.pos- the position from which the seaching needs to be done.- Returns:
- the position at which the first occurrence of the Byte array is found.
- Throws:
java.sql.SQLException
-
BLOBGETLENGTH
public static long BLOBGETLENGTH(int LOCATOR) throws java.sql.SQLExceptionReturns the length in bytes of the Blob.- Parameters:
LOCATOR- the locator value of the Blob whose length needs to be found.- Returns:
- the length of the Blob object mapped to the locator .
- Throws:
java.sql.SQLException
-
BLOBGETBYTES
public static byte[] BLOBGETBYTES(int LOCATOR, long pos, int len) throws java.sql.SQLExceptionReads up to len bytes from the associatedBloband returns a byte array containing the bytes read.Note that a smaller number of bytes than requested might be returned. The number of bytes returned can be found by checking the length of the returned byte array.
- Parameters:
LOCATOR- the locator value of the Blob from which the byte array needs to be retrieved.len- the maximum number of bytes to read. The value will be reduced to the maximum allowed return length if required (seeLimits.MAX_BLOB_RETURN_LEN).pos- the position from which the bytes from the Blob need to be retrieved.- Returns:
- A byte array containing the bytes read, starting from position
posin theBlob. - Throws:
java.sql.SQLException
-
BLOBSETBYTES
public static void BLOBSETBYTES(int LOCATOR, long pos, int len, byte[] replaceBytes) throws java.sql.SQLExceptionReplaces the bytes at pos with len bytes- Parameters:
LOCATOR- the integer that represents the Blob in which the bytes need to be replaced.pos- the position stating from which the byte replacement needs to happen.len- the number of bytes that need to be used in replacement.replaceBytes- the byte array that contains the bytes that needs to be used for replacement.- Throws:
java.sql.SQLException
-
BLOBTRUNCATE
public static void BLOBTRUNCATE(int LOCATOR, long length) throws java.sql.SQLExceptiontruncates the Blob value represented by LOCATOR to have a length of length.- Parameters:
LOCATOR- an integer that represents the LOCATOR used to retrieve an instance of the LOB.length- an integer that represents the length to which the Blob must be truncated to.- Throws:
java.sql.SQLException
-
getBlobObjectCorrespondingtoLOCATOR
private static java.sql.Blob getBlobObjectCorrespondingtoLOCATOR(int LOCATOR) throws java.sql.SQLExceptionreturns the Blob object corresponding to the locator.- Parameters:
LOCATOR- an integer that represents the locator corresponding to the Blob object requested.- Returns:
- a Blob object that is mapped to the LOCATOR object passed in.
- Throws:
java.sql.SQLException
-
getEmbedConnection
private static EmbedConnection getEmbedConnection() throws java.sql.SQLException
Returns the EmbedConnection object.- Throws:
java.sql.SQLException
-
newSQLException
private static java.sql.SQLException newSQLException(java.lang.String messageId)
Generate the SQLException with the appropriate SQLState.- Parameters:
messageId- The messageId of the message associated with this message.- Returns:
- a SQLEXception.
-
-