Class BindUploader

    • Method Detail

      • newInstance

        public static BindUploader newInstance​(SFBaseSession session,
                                               String stageDir)
        Create a new BindUploader which will upload to the given stage path. Note that no temporary file or directory is created anymore. Instead, streaming uploading is used.
        Parameters:
        session - the session to use for uploading binds
        stageDir - the stage path to upload to
        Returns:
        BindUploader instance
      • upload

        public void upload​(Map<String,​ParameterBindingDTO> bindValues,
                           boolean compressData)
                    throws BindException,
                           SQLException
        Upload bind parameters via streaming. This replaces previous function upload function where binds were written to a file which was then uploaded with a PUT statement.
        Parameters:
        bindValues - the bind map to upload
        compressData - whether or not to compress data
        Throws:
        BindException
        SQLException
      • close

        public void close()
        Close uploader, deleting the local temporary directory

        This class can be used in a try-with-resources statement, which ensures that the temporary directory is cleaned up even when exceptions occur

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
      • setInputStreamBufferSize

        public void setInputStreamBufferSize​(int bufferSize)
        Set the approximate maximum size in bytes for a single bind file
        Parameters:
        bufferSize - size in bytes
      • getFileCount

        public int getFileCount()
        Return the number of files that binding data is split into on internal stage. Used for testing purposes.
        Returns:
        number of files that binding data is split into on internal stage
      • getStagePath

        public String getStagePath()
        Return the stage path to which binds are uploaded
        Returns:
        the stage path
      • arrayBindValueCount

        public static int arrayBindValueCount​(Map<String,​ParameterBindingDTO> bindValues)
        Compute the number of array bind values in the given bind map
        Parameters:
        bindValues - the bind map
        Returns:
        0 if bindValues is null, has no binds, or is not an array bind n otherwise, where n is the number of binds in the array bind
      • isArrayBind

        public static boolean isArrayBind​(Map<String,​ParameterBindingDTO> bindValues)
        Return whether the bind map uses array binds
        Parameters:
        bindValues - the bind map
        Returns:
        whether the bind map uses array binds