217 lines
14 KiB
HTML
217 lines
14 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="SQLGetDescField - Get descriptor field" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzadphdapi.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzadpgdesfld" />
|
|
<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>SQLGetDescField</title>
|
|
</head>
|
|
<body id="rzadpgdesfld"><a name="rzadpgdesfld"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">SQLGetDescField - Get descriptor field</h1>
|
|
<div><div class="section"></div>
|
|
<div class="section"><h4 class="sectiontitle">Purpose</h4> <p><samp class="codeph">SQLGetDescField()</samp> obtains
|
|
a value from a descriptor. <samp class="codeph">SQLGetDescField()</samp> is a more extensible
|
|
alternative to the <samp class="codeph">SQLGetDescRec()</samp> function.</p>
|
|
<p>This function
|
|
is similar to that of <samp class="codeph">SQLDescribeCol()</samp> but <samp class="codeph">SQLGetDescField()</samp> can
|
|
retrieve data from parameter descriptors as well as row descriptors.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLGetDescField (SQLHDESC hdesc,
|
|
SQLSMALLINT irec,
|
|
SQLSMALLINT fDescType,
|
|
SQLPOINTER rgbDesc,
|
|
SQLINTEGER bLen,
|
|
SQLINTEGER *sLen);</pre>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Function arguments</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. SQLGetDescField arguments</caption><thead align="left"><tr><th align="left" valign="top" width="20%" id="d0e62">Data type</th>
|
|
<th align="left" valign="top" width="20%" id="d0e64">Argument</th>
|
|
<th align="left" valign="top" width="20%" id="d0e66">Use</th>
|
|
<th align="left" valign="top" width="40%" id="d0e68">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLHDESC</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>hdesc</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">Descriptor handle.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLSMALLINT</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>irec</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">The number of records in the descriptor matches
|
|
the number of columns in the result set for a row descriptor, or the number
|
|
of parameters in a parameter descriptor.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLSMALLINT</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>fDescType</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">See <a href="#rzadpgdesfld__tddtyp">Table 2</a>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLPOINTER</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>rgbDesc</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Output</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">Pointer to buffer.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLINTEGER</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>bLen</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">Length of descriptor buffer (<em>rgbDesc</em>).</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e62 ">SQLINTEGER *</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e64 "><em>sLen</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e66 ">Output</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e68 ">Actual number of bytes in the descriptor
|
|
to return. If this argument contains a value equal to or higher than the length <em>rgbDesc</em> buffer,
|
|
truncation occurs.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="rzadpgdesfld__tddtyp"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rzadpgdesfld__tddtyp" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 2. fDescType
|
|
descriptor types</caption><thead align="left"><tr><th align="left" valign="top" width="50.18587360594795%" id="d0e149">Descriptor</th>
|
|
<th align="left" valign="top" width="17.286245353159853%" id="d0e151">Type</th>
|
|
<th align="left" valign="top" width="32.52788104089219%" id="d0e153">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_ALLOC_TYPE</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Either SQL_DESC_ALLOC_USER if the application
|
|
explicitly allocated the descriptor, or SQL_DESC_ALLOC_AUTO if the implementation
|
|
automatically allocated the descriptor.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_COUNT</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">The number of records in the descriptor is
|
|
returned in <em>rgbDesc</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_DATA_PTR</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SQLPOINTER</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the data pointer field for <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_DATETIME_INTERVAL_CODE</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the interval code for records with
|
|
a type of SQL_DATETIME. The interval code further defines the SQL_DATETIME
|
|
data type. The code values are SQL_CODE_DATE, SQL_CODE_TIME, and SQL_CODE_TIMESTAMP.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_INDICATOR_PTR</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SQLPOINTER</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the indicator pointer field for <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_LENGTH_PTR</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SQLPOINTER</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the length pointer field for <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_LENGTH</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">INTEGER</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the LENGTH field of <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_NAME</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">CHAR(128)</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the NAME field of <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_NULLABLE</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">If <em>irec</em> can contain nulls, then SQL_NULLABLE
|
|
is returned in <em>rgbDesc</em>. Otherwise, SQL_NO_NULLS is returned in <em>rgbDesc</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_PRECISION</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the PRECISION field of <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_SCALE</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the SCALE field of <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_TYPE</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">Retrieve the TYPE field of <em>irec</em>.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="50.18587360594795%" headers="d0e149 ">SQL_DESC_UNNAMED</td>
|
|
<td align="left" valign="top" width="17.286245353159853%" headers="d0e151 ">SMALLINT</td>
|
|
<td align="left" valign="top" width="32.52788104089219%" headers="d0e153 ">This is SQL_NAMED if the NAME field is an
|
|
actual name, or SQL_UNNAMED if the NAME field is an implementation-generated
|
|
name.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Usage</h4><p>The number of records in the descriptor corresponds
|
|
to the number of columns in the result set, if the descriptor is row descriptor,
|
|
or the number of parameters, for a parameter descriptor.</p>
|
|
<p>Calling <samp class="codeph">SQLGetDescField()</samp> with <em>fDescType</em> set
|
|
to SQL_DESC_COUNT is an alternative to calling <samp class="codeph">SQLNumResultCols()</samp> to
|
|
determine whether any columns can be returned.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Return codes</h4><ul><li>SQL_SUCCESS</li>
|
|
<li>SQL_SUCCESS_WITH_INFO</li>
|
|
<li>SQL_ERROR</li>
|
|
<li>SQL_INVALID_HANDLE</li>
|
|
<li>SQL_NO_DATA_FOUND</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Diagnostics</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 3. SQLGetDescField SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="top" width="25%" id="d0e328">SQLSTATE</th>
|
|
<th align="left" valign="top" width="25%" id="d0e330">Description</th>
|
|
<th align="left" valign="top" width="50%" id="d0e332">Explanation</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="25%" headers="d0e328 "><strong>HY</strong>009</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e330 ">Argument value that is not valid</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e332 ">The value specified for the argument <em>fDescType</em> or <em>irec</em> is
|
|
not valid. <p>The argument <em>rgbDesc</em> or <em>sLen</em> is a null pointer.</p>
|
|
</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="25%" headers="d0e328 "><strong>HY</strong>013 <strong>*</strong></td>
|
|
<td align="left" valign="top" width="25%" headers="d0e330 ">Memory management problem</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e332 ">The driver is unable to access the memory
|
|
required to support the processing or completion of the function.</td>
|
|
</tr>
|
|
<tr><td valign="top" width="25%" headers="d0e328 "><p><strong>HY</strong>021</p>
|
|
</td>
|
|
<td valign="top" width="25%" headers="d0e330 "><p><img src="./delta.gif" alt="Start of change" />Internal descriptor that is not
|
|
valid<img src="./deltaend.gif" alt="End of change" /></p>
|
|
</td>
|
|
<td valign="top" width="50%" headers="d0e332 "><p><img src="./delta.gif" alt="Start of change" />The internal descriptor cannot be
|
|
addressed or allocated, or it contains a value that is not valid.<img src="./deltaend.gif" alt="End of change" /></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">References</h4><ul><li><a href="rzadpfnbindc.htm#rzadpfnbindc">SQLBindCol - Bind a column to an application variable</a></li>
|
|
<li><a href="rzadpfndecol.htm#rzadpfndecol">SQLDescribeCol - Describe column attributes</a></li>
|
|
<li><a href="rzadpfnexecd.htm#rzadpfnexecd">SQLExecDirect - Execute a statement directly</a></li>
|
|
<li><a href="rzadpfnexec.htm#rzadpfnexec">SQLExecute - Execute a statement</a></li>
|
|
<li><a href="rzadpfnprep.htm#rzadpfnprep">SQLPrepare - Prepare a statement</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadphdapi.htm" title="This topic provides a description of each CLI function.">DB2 UDB CLI functions</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |