Posts

Showing posts from January, 2011

Passing function parameters from JavaScript to JavaFX

Most of the time, you won't notice a delay while calling JavaFX functions from JavaScript. However, there are times you may have performance issues. Recently, we had such an issue in one of our projects: A JavaScript function was consuming a considerable amount of time. When we looked into the problem, we noticed that we were passing a big JavaScript String array to a JavaFX function as a parameter. Obviously, there was an issue about passing the array object. As an alternative, we concatenated the values in the String array and passed them to JavaFX as a single String object. And it worked! Our application ran much faster after this change.

I have created a simple JavaFX application for testing purposes. The code has two different functions which take different parameters:

import javafx.scene.*; // This function takes a String array as parameter function passStringArray(value: String[]){ } // This function takes a String as parameter function passString(value : Stri…

Adding CLOB values to XML as CDATA

Adding large CLOB values into an XML structure using XMLDOM package in PL/SQL is challenging because XMLDOM methods do not accept CLOB data type.

The solution is to divide large CLOB values into multiple smaller chunks. The size of each chunk we create is 8000. We are not using the maximum length allowed for VARCHAR2 data type (32767 bytes) because we have a multi-lingual database and some characters are stored in 4 bytes.
We are using CDATA nodes to store these chunks because our CLOB values generally contain data as XML and we don’t want to deal with escape characters.

The following function takes a CLOB and an XMLDOM.domNode as parameters and returns an XMLDOM.domNode which contains the CLOB value. If the length of the CLOB is bigger than the defined maximum length (8000 in our case), the method divides the CLOB into several chunks prior including it to the domNode.

function addValueToXMLNode(in_parent_node xmldom.domNode, in_value_cl CLOB) return xmldom.domNode is v_offset_nr…