The disclosures herein relate generally to content management systems and more particularly to addressing problems associated with the lack of handling of structured data by stored procedures.
Modem computer database environments such as shown in
Stored procedures in a content management system typically only handle primitive data types such as integer, long, binary large object (BLOB) and character large object (CLOB) in the parameter passing carried out by the procedure's interface (API). The interface of the conventional stored procedure does not provide parameter passing of structured data with variable length data such as 1) an array of integers; 2) an array of character strings, or 3) an array of mixed data types.
Some content management software is based on a set of stored procedures that interact with database servers, such as DB2 servers, for example. These stored procedures do not pass structured data and this can present a problem in many applications.
What is needed is a mechanism and methodology for handling parameter passing of structured data for stored procedures in a client-server content management system.
Accordingly, a method of communicating data between a stored procedure in a server and a client is disclosed which includes calling, by the stored procedure, a utility interface program in the server. The utility interface program encodes the data in a structured data format including a plurality of elements. The encoded data is transmitted by the server in the structured data format to the client. The client receives the encoded data and calls the utility interface program in the server to decode the encoded data. In one embodiment of the disclosed methodology, the structured data format includes a binary large object (BLOB) and a character large object (CLOB) to enable handling of both binary data and variable length character strings.
A principal advantage of the embodiment disclosed herein is the ability to handle parameter passing of structured data between a stored procedure and a client system.
The disclosed methodology for handling parameter passing of structured data for store procedures in a content management system is now discussed. Content management system 100 includes at least one stored procedure 110 which is connected via its interface 115 to a client computer 120. The disclosed method involves communication of data between stored procedure 110 and client 120. An orthogonal data format provides a foundation for handling structured data communication including binary data, character data and mixed (binary and character) data.
The method includes an encoding process and a decoding process. The encoding process builds a data format for input parameters with structured data of stored procedure 110. In other words, a data format for parameter passing is constructed. The decoding process parses the data format for output parameters with structured data of stored procedure 110.
Stored procedures are often used to provide queries to a database repository. However, in the disclosed methodology, stored procedures can perform different functions. More particularly, when server 100 desires to transmit data to client 120, an encode/decode utility located in stored procedure 110 or its interface 115 is called. The utility acts as an encoder to encode the data in a BLOB/CLOB pair (binary large object/character large object pair) which is transmitted via interface 115 to client 120. In actual practice, the utility interface program may be located in interface 115 where it can be called by either stored procedure 110 or client 120. When client 120 receives the BLOB/CLOB pair, client 120 calls the utility interface program associated with the stored procedure, and the utility decodes the BLOB/CLOB pair to restore the original data for use by client 120.
Conversely, when client 120 desires to transmit data to stored procedure 110 of server 100, client 120 calls the utility interface program which encodes the data into the BLOB/CLOB pair which is then sent along to the stored procedure. The stored procedure can then decode the data as before. From the above, it will be appreciated that the utility can perform a bidirectional encode/decode operation depending on the circumstances. Either the stored procedure or the client can call the utility for encoding and decoding operations. Advantageously, the BLOB/CLOB pair data format employed by the utility enables communication of many kinds of data including structured data with variable length data such as integer arrays, character string arrays, binary data, character data and arrays of mixed data types (binary and character data).
Each piece of data which is to be built (encoded) or parsed (decoded) is placed in a BLOB/CLOB as an element. An element is composed of an element ID, a data type, a length and a value. The element ID identifies the element. For example, the element ID may be a component ID, a customer number or an account number. The data type describes the particular type of data, for example, binary, character or mixed. The length denotes the length of the data value to be passed between the stored procedure and client or vice versa. For integer types of data the length is fixed; however, for character data the length depends on the length of the particular string to be passed. The value represents the actual value to be passed.
Each part of the element is stored in the BLOB or CLOB. Element ID, the data type and the length are stored as a header in the BLOB. It is acceptable to store the value in either the BLOB or CLOB depending on the data type. In other words, the BLOB is used to store header data and binary data, whereas the CLOB is used to store character data. In the particular embodiment shown in the drawings subsequently discussed, a header contains an element ID (a 2 byte integer), a data type (a 2 byte integer) and a length (a 4 byte integer).
Three operational scenarios are now discussed with reference to
Returning to the binary data scenario data structure of
The other type of mixed data for which the data structure of
Returning now to
In one embodiment, interface 115 supports the following data types: sqlint16, sqlint32, sqlint64, double, character and binary data types. These data types are supported as either NULLable or nonNULLable. When the utility program encodes or builds the BLOB and CLOB, the data type is specified. When parsing or decoding, the data type is also specified to the utility program. If the date type upon encode does not equal the data type upon decode, the utility program returns an error. An exception to this error rule is that a nonNULLable data type can be built into the BLOB and CLOB and can be parsed as a NULLable data type. This is valid because nonNULLable is a subset of NULLable.
One example of the above mentioned utility interface program 115 that can be used for the encoding and decoding functions is now described with reference to a C language implementation. The utility uses a structure to hold all of the information with respect to the BLOB and CLOB. The structure is declared and initialized using one of the initialization routines discussed below. In actual practice, there are two different types of initialization, namely one for encoding and one for decoding. The structure is passed to other routines in the utility and is used for manipulating the data in the BLOB and CLOB. One structure which is acceptable is:
The utility program includes a number of routines to initialize the structure. These routines are given below along with comments which describe the specific purpose of each routine: The acronym “SP” refers to stored procedure 110 and “API” refers to application program interface.
The utility program includes additional functions which are used to handle freeing of memory and to prepare the BLOB and CLOB to be sent between stored procedure 110 and client 120. In actual practice, a memory freeing routine is only needed after the build or encoding because in the decoding or parsing, BLOB and CLOB data is used directly from a host variable used to pass the data. A “prepare to send” routine is called to set the data length properly in the BLOB before it is sent between client 120 and stored procedure 110. These routines are now presented below:
The utility program (here a C interface) provides one routine to build or encode the BLOB CLOB and two routines to parse or decode the BLOB CLOB. These routines take in variable parameter lists to advantageously allow many values to be handled in a single call. In one embodiment, each routine takes in the BLOB/CLOB structure, a structure containing log information and a repeating list of elements. As discussed earlier, each element includes an element ID, a data type, a length, and the actual data value which may be either binary or character data. More specifically, element ID's are declared in lspdef.h. The data type is one of the constants referenced above. The value can be a pointer to the actual data value. The data type varies according to whether binary, character or mixed data is being manipulated. In more detail:
The utility program or C interface includes a parse routine which handles NULL values. This functionality is needed to process NULLable data types. The parse routine returns an indicator for each element that indicates whether the particular value is NULL. More specifically, the indicator is set to −1 if the value is NULL. In the build routine, the length is set to −1 to indicate a NULL value.
A representative parse routine for handling NULL values is given below:
The content management system can be stored on virtually any computer-readable storage media, such as CD, DVD and other magnetic and optical media in either compressed or non-compressed form. Of course, it can also be stored on a server computer system or other information handling system.
As can be seen, a principal advantage of the disclosed methodology and apparatus is to provide for parameter passing of structured data for stored procedures in a content management system. Desirably, structured data with variable length such as an array of integers, an array of character strings, or an array of mixed data types are all accommodated in the disclosed interface between a stored procedure in a server and a client system. Without the disclosed methodology, each stored procedure in the content management system server would generally require interface customization to meet its special needs in parameter passing. The disclosed technology advantageously obviates this problem. It should be understood that while one representative stored procedure has been discussed with reference to the disclosed content management system, in actual practice the server of the system can contain multiple stored procedures and multiple clients employing the disclosed methodology can be coupled to the server.
Although illustrative embodiments have been shown and described, a wide range of modification, change and substitution is contemplated in the foregoing disclosure and in some instances, some features of an embodiment may be employed without a corresponding use of other features. Accordingly, it is appropriate that the appended claims be construed broadly and in a manner consistent with the scope of the embodiments disclosed herein.
Number | Name | Date | Kind |
---|---|---|---|
4751740 | Wright | Jun 1988 | A |
4969091 | Muller | Nov 1990 | A |
5615337 | Zimowski et al. | Mar 1997 | A |
5632015 | Zimowski et al. | May 1997 | A |
5644768 | Periwal et al. | Jul 1997 | A |
5742810 | Ng et al. | Apr 1998 | A |
5774719 | Bowen | Jun 1998 | A |
5778398 | Nagashima et al. | Jul 1998 | A |
5799310 | Anderson et al. | Aug 1998 | A |
5819252 | Benson et al. | Oct 1998 | A |
5862378 | Wang et al. | Jan 1999 | A |
5875332 | Wang et al. | Feb 1999 | A |
5892902 | Clark | Apr 1999 | A |
5940616 | Wang | Aug 1999 | A |
6012067 | Sarkar | Jan 2000 | A |
6016394 | Walker | Jan 2000 | A |
6047291 | Anderson et al. | Apr 2000 | A |
6055637 | Hudson et al. | Apr 2000 | A |
6063133 | Li et al. | May 2000 | A |
6065117 | White | May 2000 | A |
6067414 | Wang et al. | May 2000 | A |
6073168 | Mighdoll et al. | Jun 2000 | A |
6088524 | Levy et al. | Jul 2000 | A |
6104393 | Santos-Gomez | Aug 2000 | A |
6128621 | Weisz | Oct 2000 | A |
6148342 | Ho | Nov 2000 | A |
6161182 | Nadooshan | Dec 2000 | A |
6167405 | Rosensteel, Jr. et al. | Dec 2000 | A |
6173400 | Perlman et al. | Jan 2001 | B1 |
6219826 | De Pauw et al. | Apr 2001 | B1 |
6233586 | Chang et al. | May 2001 | B1 |
6249822 | Kays, Jr. et al. | Jun 2001 | B1 |
6263313 | Milsted et al. | Jul 2001 | B1 |
6263342 | Chang et al. | Jul 2001 | B1 |
6272488 | Chang et al. | Aug 2001 | B1 |
6279111 | Jensenworth et al. | Aug 2001 | B1 |
6282649 | Lambert et al. | Aug 2001 | B1 |
6289344 | Braia et al. | Sep 2001 | B1 |
6289458 | Garg et al. | Sep 2001 | B1 |
6292936 | Wang | Sep 2001 | B1 |
6308274 | Swift | Oct 2001 | B1 |
6314449 | Gallagher et al. | Nov 2001 | B1 |
6327629 | Wang et al. | Dec 2001 | B1 |
6338056 | Dessloch et al. | Jan 2002 | B1 |
6339777 | Attaluri et al. | Jan 2002 | B1 |
6343286 | Lee et al. | Jan 2002 | B1 |
6751798 | Schofield | Jun 2004 | B1 |
6751799 | Kays et al. | Jun 2004 | B1 |
6845392 | Koontz et al. | Jan 2005 | B1 |
20010002486 | Kocher et al. | May 2001 | A1 |
20010008015 | Vu et al. | Jul 2001 | A1 |
20010019614 | Madoukh | Sep 2001 | A1 |
20030200256 | Hu et al. | Oct 2003 | A1 |
Number | Date | Country |
---|---|---|
WO 9922362 | May 1999 | WO |
Number | Date | Country | |
---|---|---|---|
20030200256 A1 | Oct 2003 | US |