Lecture
<allocate descriptor statement> :: = ALLOCATE DESCRIPTOR <descriptor name> [WITH MAX <occurrences>] <occurences> :: = <simple value specification> <descriptor name> :: = (<scope option>] <simple value specification> <scope option> :: = GLOBAL | LOCAL <simple value specification> :: = <parameter name> (<embedded variable name> (<literal>
Comment:
A descriptor is a dynamically allocated part of an application's memory that is used to accept information about the result or parameters of a dynamically prepared SQL statement or to set parameters for such an operator. The fact that the SQL statement is used to allocate memory, and not just the standard alloc function or some other dynamic memory query function, is that the application program does not know the structure of the descriptor and even its address. This allows you not to bind SQL to the features of any programming system or operating system. All exchanges of information between the actual application program and the descriptors are also performed using special SQL statements (GET and SET, see below).
The second question: why allocate memory for handles at all dynamically. This is necessary because, in the general case, an application using dynamic SQL does not know statically the number of concurrent dynamic SQL statements whose description may be required. The fact that the descriptor name can be specified either as a literal string of characters or through a string variable of the including language, i.e. it can be generated during program execution.
The ALLOCATE DESCRIPTOR statement, among other things, may specify the number of descriptive elements for which it is intended. If, for example, when allocating memory for a descriptor, a positive integer N is specified in the WITH MAX section, and then the descriptor is used to describe M (M> N) elements (for example, M columns of the query result), then this causes an exception.
Comments
To leave a comment
Databases IBM System R - relational DBMS
Terms: Databases IBM System R - relational DBMS