Class LOBStoredProcedure

java.lang.Object
org.apache.derby.impl.jdbc.LOBStoredProcedure

public class LOBStoredProcedure extends Object
Contains the stored procedures that will be used in the LOB client side methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    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 associated Blob and returns a byte array containing the bytes read.
    static long
    BLOBGETLENGTH(int LOCATOR)
    Returns the length in bytes of the Blob.
    static long
    BLOBGETPOSITIONFROMBYTES(int LOCATOR, byte[] searchBytes, long pos)
    Returns the first occurrence of the byte array in the Blob.
    static long
    BLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long pos)
    Returns the first occurrence of locator in the Blob.
    static void
    BLOBRELEASELOCATOR(int LOCATOR)
    Removes the supplied LOCATOR entry from the hash map.
    static void
    BLOBSETBYTES(int LOCATOR, long pos, int len, byte[] replaceBytes)
    Replaces the bytes at pos with len bytes
    static void
    BLOBTRUNCATE(int LOCATOR, long length)
    truncates the Blob value represented by LOCATOR to have a length of length.
    static int
    Creates a new empty Clob and registers it in the HashMap in the Connection and returns the locator value corresponding to this Clob.
    static long
    CLOBGETLENGTH(int LOCATOR)
    returns the length of the Clob corresponding to the LOCATOR value.
    static long
    CLOBGETPOSITIONFROMLOCATOR(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 long
    CLOBGETPOSITIONFROMSTRING(int LOCATOR, String searchLiteral, long fromPosition)
    returns the first occurrence of the given search string from the given start search position inside the Clob.
    static String
    CLOBGETSUBSTRING(int LOCATOR, long pos, int len)
    Returns the String starting from pos and consisting of up to len consecutive characters from the Clob corresponding to LOCATOR.
    static void
    CLOBRELEASELOCATOR(int LOCATOR)
    Removes the supplied LOCATOR entry from the hash map.
    static void
    CLOBSETSTRING(int LOCATOR, long pos, int length, String str)
    replaces the characters starting at fromPosition and with length ForLength
    static void
    CLOBTRUNCATE(int LOCATOR, long length)
    truncates the Clob value represented by LOCATOR to have a length of length.
    private static Blob
    returns the Blob object corresponding to the locator.
    private static Clob
    returns the Clob object corresponding to the locator.
    private static EmbedConnection
    Returns the EmbedConnection object.
    private static SQLException
    Generate the SQLException with the appropriate SQLState.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LOBStoredProcedure

      public LOBStoredProcedure()
  • Method Details

    • CLOBCREATELOCATOR

      public static int CLOBCREATELOCATOR() throws SQLException
      Creates 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:
      SQLException
    • CLOBRELEASELOCATOR

      public static void CLOBRELEASELOCATOR(int LOCATOR) throws SQLException
      Removes 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:
      SQLException
    • CLOBGETPOSITIONFROMSTRING

      public static long CLOBGETPOSITIONFROMSTRING(int LOCATOR, String searchLiteral, long fromPosition) throws SQLException
      returns 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:
      SQLException
    • CLOBGETPOSITIONFROMLOCATOR

      public static long CLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long fromPosition) throws SQLException
      returns 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:
      SQLException
    • CLOBGETLENGTH

      public static long CLOBGETLENGTH(int LOCATOR) throws SQLException
      returns 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:
      SQLException
    • CLOBGETSUBSTRING

      public static String CLOBGETSUBSTRING(int LOCATOR, long pos, int len) throws SQLException
      Returns the String starting from pos and consisting of up to len consecutive characters from the Clob corresponding to LOCATOR.
      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 (see Limits.MAX_CLOB_RETURN_LEN).
      Returns:
      A substring from the Clob starting at the given position, not longer than len characters.
      Throws:
      SQLException
    • CLOBSETSTRING

      public static void CLOBSETSTRING(int LOCATOR, long pos, int length, String str) throws SQLException
      replaces 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:
      SQLException
    • CLOBTRUNCATE

      public static void CLOBTRUNCATE(int LOCATOR, long length) throws SQLException
      truncates 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:
      SQLException
    • getClobObjectCorrespondingtoLOCATOR

      private static Clob getClobObjectCorrespondingtoLOCATOR(int LOCATOR) throws SQLException
      returns 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.
    • BLOBCREATELOCATOR

      public static int BLOBCREATELOCATOR() throws SQLException
      Creates 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:
      SQLException
    • BLOBRELEASELOCATOR

      public static void BLOBRELEASELOCATOR(int LOCATOR) throws SQLException
      Removes 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:
      SQLException
    • BLOBGETPOSITIONFROMLOCATOR

      public static long BLOBGETPOSITIONFROMLOCATOR(int LOCATOR, int searchLocator, long pos) throws SQLException
      Returns 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:
      SQLException
    • BLOBGETPOSITIONFROMBYTES

      public static long BLOBGETPOSITIONFROMBYTES(int LOCATOR, byte[] searchBytes, long pos) throws SQLException
      Returns 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:
      SQLException
    • BLOBGETLENGTH

      public static long BLOBGETLENGTH(int LOCATOR) throws SQLException
      Returns 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:
      SQLException
    • BLOBGETBYTES

      public static byte[] BLOBGETBYTES(int LOCATOR, long pos, int len) throws SQLException
      Reads up to len bytes from the associated Blob and 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.
      pos - the position from which the bytes from the Blob need to be retrieved.
      len - the maximum number of bytes to read. The value will be reduced to the maximum allowed return length if required (see Limits.MAX_BLOB_RETURN_LEN).
      Returns:
      A byte array containing the bytes read, starting from position pos in the Blob.
      Throws:
      SQLException
    • BLOBSETBYTES

      public static void BLOBSETBYTES(int LOCATOR, long pos, int len, byte[] replaceBytes) throws SQLException
      Replaces 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:
      SQLException
    • BLOBTRUNCATE

      public static void BLOBTRUNCATE(int LOCATOR, long length) throws SQLException
      truncates 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:
      SQLException
    • getBlobObjectCorrespondingtoLOCATOR

      private static Blob getBlobObjectCorrespondingtoLOCATOR(int LOCATOR) throws SQLException
      returns 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:
      SQLException
    • getEmbedConnection

      private static EmbedConnection getEmbedConnection() throws SQLException
      Returns the EmbedConnection object.
      Throws:
      SQLException
    • newSQLException

      private static SQLException newSQLException(String messageId)
      Generate the SQLException with the appropriate SQLState.
      Parameters:
      messageId - The messageId of the message associated with this message.
      Returns:
      a SQLEXception.