105 lines
6.5 KiB
HTML
105 lines
6.5 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="dc.language" scheme="rfc1766" 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. -->
|
|
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<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="keywords" content="description, SQLDA, application program, contents,
|
|
SQLDA (SQL descriptor area), dynamic SQL, with SQLDA, obtaining information,
|
|
prepared SQL statement, SQLDA provides information" />
|
|
<title>SQLDA (SQL descriptor area)</title>
|
|
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
|
|
<link rel="stylesheet" type="text/css" href="ic.css" />
|
|
</head>
|
|
<body>
|
|
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
|
|
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
|
|
|
|
|
|
<a name="sqldda"></a>
|
|
<h1 id="sqldda"><a href="rbafzmst02.htm#ToC_1496">Appendix D. SQLDA (SQL descriptor area)</a></h1><a id="idx3434" name="idx3434"></a><a id="idx3435" name="idx3435"></a><a id="idx3436" name="idx3436"></a><a id="idx3437" name="idx3437"></a>
|
|
<p>An SQLDA is a set of variables that is used for execution of
|
|
the SQL DESCRIBE statement, and it may optionally be used by the PREPARE,
|
|
OPEN, CALL, FETCH, and EXECUTE statements. An SQLDA can be used in a DESCRIBE
|
|
or PREPARE statement, altered with the addresses of storage areas<sup class="fn"><a id="wq1971" name="wq1971" href="rbafzmstsqldda.htm#wq1972">102</a></sup>, and then used again in a FETCH statement.</p>
|
|
<p>SQLDAs are supported for all languages, but predefined declarations are
|
|
provided only for C (and C++), COBOL, ILE RPG, PL/I, and REXX. In REXX, the
|
|
SQLDA is somewhat different than in the other languages; for information on
|
|
the use of SQLDAs in REXX, see the <a href="../rzajp/rzajpkickoff.htm">Embedded SQL Programming</a> book.</p>
|
|
<p>The meaning of the information in an SQLDA depends on its use.</p>
|
|
<ul>
|
|
<li><span>When an SQLDA is used in a DESCRIBE or PREPARE statement,</span> an
|
|
SQLDA provides information to an application program about a prepared <var class="pv">select-statement</var>. <a id="idx3438" name="idx3438"></a><a id="idx3439" name="idx3439"></a> Each column of the
|
|
result table is described in an SQLVAR occurrence or set of related SQLVAR
|
|
occurrences.</li>
|
|
<li>In OPEN, EXECUTE, CALL, and FETCH, an SQLDA provides information to the
|
|
database manager about storage areas for input or output data. Each storage
|
|
area is described in the SQLVARs.
|
|
<ul>
|
|
<li>For OPEN and EXECUTE of a statement other than CALL, each SQLVAR occurrence
|
|
or set of related SQLVAR occurrences describes a storage area that is used
|
|
to contain an input value which is substituted for a parameter marker in the
|
|
associated SQL statement that was previously prepared.</li>
|
|
<li>For FETCH, each SQLVAR occurrence or set of related SQLVAR occurrences
|
|
describes a <span>storage area</span> that is used to contain an output value
|
|
from a row of the result table.</li>
|
|
<li>For CALL and EXECUTE of a prepared CALL statement, each SQLVAR occurrence
|
|
or set of related SQLVAR occurrences describes a <span>storage area</span> that
|
|
is used to contain an input or output value (or both) that corresponds to
|
|
an argument in the argument list for the procedure.</li></ul></li></ul>
|
|
<p>An SQLDA consists of four variables in a header followed by an arbitrary
|
|
number of occurrences of a <var class="pv">base SQLVAR</var>. When the SQLDA desribes either
|
|
LOBs or distint types the base SQLVARs are followed by the same number of
|
|
occurrences of an <var class="pv">extended SQLVAR</var>.</p>
|
|
<dl>
|
|
<dt class="bold">Base SQLVAR entry </dt>
|
|
<dd>The base SQLVAR entry is always present. The fields of this entry contain
|
|
the base information about the column or variable such as data type code,
|
|
length attribute (except for LOBs), column name (or label), CCSID, variable
|
|
address, and indicator variable address.
|
|
</dd>
|
|
<dt class="bold">Extended SQLVAR entry </dt>
|
|
<dd>The extended SQLVAR entry is needed (for each column) if the result
|
|
includes any LOB or distinct type columns. For distinct types, the extended
|
|
SQLVAR contains the distinct type name. For LOBs, the extended SQLVAR contains
|
|
the length attribute of the variable and a pointer to the buffer that contains
|
|
the actual length. If locators or file reference variables are used to represent
|
|
LOBs, an extended SQLVAR is not necessary.
|
|
<p>The extended SQLVAR entry is
|
|
also needed for each column when:</p>
|
|
<ul>
|
|
<li>USING BOTH is specified, which indicates that column names and labels
|
|
are returned.</li>
|
|
<li>USING ALL is specified, which indicates that column names, labels, and
|
|
system column names are returned.</li></ul>
|
|
<p>The fields in the extended SQLVAR that return LOB and distinct
|
|
type information do not overlap, and the fields that return LOB and label
|
|
information do not overlap. Depending on the combination of labels, LOBs and
|
|
distinct types, more than one extended SQLVAR entry per column may be required
|
|
to return the information. See <a href="rbafzmstfielddescsqlda.htm#howmany">Determining how many SQLVAR occurrences are needed</a>.</p>
|
|
</dd>
|
|
</dl>
|
|
<hr /><div class="fnnum"><a id="wq1972" name="wq1972" href="rbafzmstsqldda.htm#wq1971">102</a>.</div>
|
|
<div class="fntext">A storage
|
|
area could be the storage for a variable defined in the program (that may
|
|
also be a host variable) or an area of storage explicitly allocated by the
|
|
application.</div>
|
|
<br />
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstincludesqlca.htm">Previous Page</a> | <a href="rbafzmstfielddescsqlda.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
|
|
<a href="rbafzmstindex.htm#index">Index</a> ]
|
|
|
|
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
|
|
</body>
|
|
</html>
|