191 lines
11 KiB
HTML
191 lines
11 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="SQLDA format" />
|
||
|
<meta name="abstract" content="The SQLDA consists of four variables followed by an arbitrary number of occurrences of a sequence of six variables collectively named SQLVAR." />
|
||
|
<meta name="description" content="The SQLDA consists of four variables followed by an arbitrary number of occurrences of a sequence of six variables collectively named SQLVAR." />
|
||
|
<meta name="DC.subject" content="SQLDA (SQL descriptor area), format, dynamic SQL, SQLDA (SQL descriptor area) format, SQLDAID, SQLDABC, SQLN, SQLD, SQLVAR, SQLTYPE, SQLLEN, SQLRES, SQLDATA, SQLIND, SQLNAME, SQLVAR2, SQLLONGLEN, SQLDATALEN, SQLDATATYPE_NAME" />
|
||
|
<meta name="keywords" content="SQLDA (SQL descriptor area), format, dynamic SQL, SQLDA (SQL descriptor area) format, SQLDAID, SQLDABC, SQLN, SQLD, SQLVAR, SQLTYPE, SQLLEN, SQLRES, SQLDATA, SQLIND, SQLNAME, SQLVAR2, SQLLONGLEN, SQLDATALEN, SQLDATATYPE_NAME" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafyprocesssqlda.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../rzajp/rzajprexx.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydynexample.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafysqldaformat" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>SQLDA format</title>
|
||
|
</head>
|
||
|
<body id="rbafysqldaformat"><a name="rbafysqldaformat"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">SQLDA format</h1>
|
||
|
<div><p>The SQLDA consists of four variables followed by an arbitrary number
|
||
|
of occurrences of a sequence of six variables collectively named SQLVAR.</p>
|
||
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> The SQLDA in REXX is different. </div>
|
||
|
<p>When an SQLDA is used in OPEN, FETCH, CALL, and EXECUTE, each occurrence
|
||
|
of SQLVAR describes a host variable.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>The fields of the SQLDA are as follows:</p>
|
||
|
<dl><dt class="dlterm">SQLDAID</dt>
|
||
|
<dd>SQLDAID is as used an 'eyecatcher" for storage dumps. It is a string of
|
||
|
8 characters that have the value <samp class="codeph">'</samp>SQLDA<samp class="codeph">'</samp> after
|
||
|
the SQLDA is used in a PREPARE or DESCRIBE statement. This variable is not
|
||
|
used for FETCH, OPEN, CALL, or EXECUTE. <p>Byte 7 can be used to determine
|
||
|
if more than one SQLVAR entry is needed for each column. Multiple SQLVAR entries
|
||
|
may be needed if there are any LOB or distinct type columns. This flag is
|
||
|
set to a blank if there are not any LOBs or distinct types.</p>
|
||
|
<p>SQLDAID
|
||
|
is not applicable in REXX.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLDABC</dt>
|
||
|
<dd>SQLDABC indicates the length of the SQLDA. It is a 4-byte integer that
|
||
|
has the value SQLN*LENGTH(SQLVAR) + 16 after the SQLDA is used in a PREPARE
|
||
|
or DESCRIBE statement. SQLDABC must have a value equal to or greater than
|
||
|
SQLN*LENGTH(SQLVAR) + 16 before it is used by FETCH, OPEN, CALL, or EXECUTE.
|
||
|
<p>SQLABC is not applicable in REXX.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLN</dt>
|
||
|
<dd>SQLN is a 2-byte integer that specifies the total number of occurrences
|
||
|
of SQLVAR. It must be set before being used by any SQL statement to a value
|
||
|
greater than or equal to 0. <p>SQLN is not applicable in REXX.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLD</dt>
|
||
|
<dd>SQLD is a 2-byte integer that specifies the number of occurrences of SQLVAR,
|
||
|
in other words, the number of host variables or columns described by the SQLDA.
|
||
|
This field is set by SQL on a DESCRIBE or PREPARE statement. In other statements,
|
||
|
this field must be set before being used to a value greater than or equal
|
||
|
to 0 and less than or equal to SQLN.</dd>
|
||
|
<dt class="dlterm">SQLVAR</dt>
|
||
|
<dd>This group of values are repeated once for each host variable or column.
|
||
|
These variables are set by SQL on a DESCRIBE or PREPARE statement. In other
|
||
|
statements, they must be set before being used. These variables are defined
|
||
|
as follows: <dl><dt class="dlterm">SQLTYPE</dt>
|
||
|
<dd>SQLTYPE is a 2-byte integer that specifies the data type
|
||
|
of the host variable or column. See <a href="../db2/rbafzmstsqltc.htm#sqltc">SQLTYPE
|
||
|
and SQLLEN</a> for a table of the valid values.
|
||
|
Odd values for SQLTYPE show that the host variable has an associated indicator
|
||
|
variable addressed by SQLIND.</dd>
|
||
|
<dt class="dlterm">SQLLEN</dt>
|
||
|
<dd>SQLLEN is a 2-byte integer variable that specifies the length attribute
|
||
|
of the host variable or column.</dd>
|
||
|
<dt class="dlterm">SQLRES</dt>
|
||
|
<dd>SQLRES is a 12-byte reserved area for boundary alignment purposes. Note
|
||
|
that, in <span class="keyword">i5/OS™</span>, pointers <em>must</em> be
|
||
|
on a quad-word boundary. <p>SQLRES is not applicable in REXX.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLDATA</dt>
|
||
|
<dd>SQLDATA is a 16-byte pointer variable that specifies the address of the
|
||
|
host variables when the SQLDA is used on OPEN, FETCH, CALL, and EXECUTE. <p>When
|
||
|
the SQLDA is used on PREPARE and DESCRIBE, this area is overlaid with the
|
||
|
following information:</p>
|
||
|
<p>The CCSID of a character or graphic field is
|
||
|
stored in the third and fourth bytes of SQLDATA. For BIT data, the CCSID is
|
||
|
65535. In REXX, the CCSID is returned in the variable SQLCCSID.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLIND</dt>
|
||
|
<dd>SQLIND is a 16-byte pointer that specifies the address of a small integer
|
||
|
host variable that is used as an indication of null or not null when the SQLDA
|
||
|
is used on OPEN, FETCH, CALL, and EXECUTE. A negative value indicates null
|
||
|
and a non-negative indicates not null. This pointer is only used if SQLTYPE
|
||
|
contains an odd value. <p>When the SQLDA is used on PREPARE and DESCRIBE,
|
||
|
this area is reserved for future use.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLNAME</dt>
|
||
|
<dd>SQLNAME is a variable-length character variable with a maximum length
|
||
|
of 30. After a PREPARE or DESCRIBE, this variable contains the name of selected
|
||
|
column, label, or system column name. In OPEN, FETCH, EXECUTE, or CALL, this
|
||
|
variable can be used to pass the CCSID of character strings. CCSIDs can be
|
||
|
passed for character and graphic host variables. <p>The SQLNAME
|
||
|
field in an SQLVAR array entry of an input SQLDA can be set to specify the
|
||
|
CCSID. See <a href="../db2/rbafzmstsname.htm#sname">CCSID
|
||
|
values in SQLDATA or SQLNAME</a> for the layout of the CCSID data in this
|
||
|
field.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> It is important to remember that the SQLNAME field is only
|
||
|
for overriding the CCSID. Applications that use the defaults do not need to
|
||
|
pass CCSID information. If a CCSID is not passed, the default CCSID for the
|
||
|
job is used.</div>
|
||
|
<p>The default for graphic host variables is the associated
|
||
|
double-byte CCSID for the job CCSID. If an associated double-byte CCSID does
|
||
|
not exist, 65535 is used.</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<div class="section"> <dl><dt class="dlterm">SQLVAR2</dt>
|
||
|
<dd>This is the Extended SQLVAR structure that contains 3 fields. Extended
|
||
|
SQLVARs are needed for all columns of the result if the result includes any
|
||
|
distinct type or LOB columns. For distinct types, they contain the distinct
|
||
|
type name. For LOBs, they contain the length attribute of the host variable
|
||
|
and a pointer to the buffer that contains the actual length. If locators
|
||
|
are used to represent LOBs, these entries are not necessary. The number of
|
||
|
Extended SQLVAR occurrences needed depends on the statement that the SQLDA
|
||
|
was provided for and the data types of the columns or parameters being described.
|
||
|
Byte 7 of SQLDAID is always set to the number of sets of SQLVARs necessary. <p>If
|
||
|
SQLD is not set to a sufficient number of SQLVAR occurrences: </p>
|
||
|
<ul><li>SQLD is set to the total number of SQLVAR occurrences needed for all sets.</li>
|
||
|
<li>A +237 warning is returned in the SQLCODE field of the SQLCA if at least
|
||
|
enough were specified for the Base SQLVAR Entries. The Base SQLVAR entries
|
||
|
are returned, but no Extended SQLVARs are returned.</li>
|
||
|
<li>A +239 warning is returned in the SQLCODE field of the SQLCA if enough
|
||
|
SQLVARs were not specified for even the Base SQLVAR Entries. No SQLVAR entries
|
||
|
are returned.</li>
|
||
|
</ul>
|
||
|
<dl><dt class="dlterm">SQLLONGLEN</dt>
|
||
|
<dd>SQLLONGLEN is a 4-byte integer variable that specifies the length attribute
|
||
|
of a LOB (BLOB, CLOB, or DBCLOB) host variable or column.</dd>
|
||
|
<dt class="dlterm">SQLDATALEN</dt>
|
||
|
<dd>SQLDATALEN is a 16-byte pointer variable that specifies the address of
|
||
|
the length of the host variable. This variable is used for LOB (BLOB, CLOB,
|
||
|
and DBCLOB) host variables only. It is not used for DESCRIBE or PREPARE. <p>If
|
||
|
this field is NULL, then the actual length of the data is stored in the 4
|
||
|
bytes immediately before the start of the data, and SQLDATA points to the
|
||
|
first byte of the field length. The length indicates the number of bytes for
|
||
|
a BLOB or CLOB, and the number of characters for a DBCLOB.</p>
|
||
|
<p>If this field
|
||
|
is not NULL, it contains a pointer to a 4-byte long buffer that contains the
|
||
|
actual length in bytes (even for DBCLOB) of the data in the buffer pointed
|
||
|
to by the SQLDATA field in the matching base SQLVAR.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm">SQLDATATYPE_NAME</dt>
|
||
|
<dd>SQLDATATYPE_NAME is a variable-length character variable with a maximum
|
||
|
length of 30. It is only used for DESCRIBE or PREPARE. This variable is set
|
||
|
to one of the following: <ul><li>For a distinct type column, the database manager sets this to the fully
|
||
|
qualified distinct type name. If the qualified name is longer than 30 bytes,
|
||
|
it is truncated.</li>
|
||
|
<li>For a label, the database manager sets this to the first 20 bytes of the
|
||
|
label. </li>
|
||
|
<li>For a column name, the database manager sets this to the column name.</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyprocesssqlda.htm" title="There are two basic types of SELECT statements: fixed list and varying list.">Process SELECT statements and use a descriptor</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="rbafydynexample.htm" title="Suppose your application needs to be able to handle a dynamic SELECT statement, one that changes from one use to the next. This statement can be read from a display, passed in from another application, or built dynamically by your application.">Example: Select-statement for allocating storage for SQLDA</a></div>
|
||
|
</div>
|
||
|
<div class="relinfo"><strong>Related information</strong><br />
|
||
|
<div><a href="../rzajp/rzajprexx.htm">Coding SQL statements in REXX Applications</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|