ibm-information-center/dist/eclipse/plugins/i5OS.ic.cli_5.4.0.1/rzadpfnpdata.htm

162 lines
9.8 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="SQLPutData - Pass data value for a parameter" />
<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="rzadpfnpdata" />
<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>SQLPutData</title>
</head>
<body id="rzadpfnpdata"><a name="rzadpfnpdata"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQLPutData - Pass data value for a parameter</h1>
<div><div class="section"></div>
<div class="section"><h4 class="sectiontitle">Purpose</h4> <p><samp class="codeph">SQLPutData()</samp> is
called following an <samp class="codeph">SQLParamData()</samp> call returning SQL_NEED_DATA
to supply parameter data values. This function can be used to send large parameter
values in pieces.</p>
</div>
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLPutData (SQLHSTMT hstmt,
SQLPOINTER rgbValue,
SQLINTEGER cbValue);</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. SQLPutData arguments</caption><thead align="left"><tr><th align="left" valign="top" width="20%" id="d0e51">Data type</th>
<th align="left" valign="top" width="20%" id="d0e53">Argument</th>
<th align="left" valign="top" width="20%" id="d0e55">Use</th>
<th align="left" valign="top" width="40%" id="d0e57">Description</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLHSTMT</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>hstmt</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Statement handle.</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLINTEGER</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>cbValue</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Length of <em>rgbValue</em>. Specifies the
amount of data sent in a call to <samp class="codeph">SQLPutData()</samp>. <p>The amount
of data can vary with each call for a given parameter. The application can
also specify SQL_NTS or SQL_NULL_DATA for <em>cbValue</em>.</p>
<p><em>cbValue</em> is
ignored for all date, time, timestamp data types, and all numeric data types
except SQL_NUMERIC and SQL_DECIMAL.</p>
<p>For cases where the C buffer type
is SQL_CHAR or SQL_BINARY, or if SQL_DEFAULT is specified as the C buffer
type and the C buffer type default is SQL_CHAR or SQL_BINARY, this is the
number of bytes of data in the <em>rgbValue</em> buffer.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLPOINTER</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>rgbValue</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Pointer to the actual data, or portion of
data, for a parameter. The data must be in the form specified in the <samp class="codeph">SQLBindParam()</samp> call
that the application used when specifying the parameter.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Usage</h4><p>The application calls <samp class="codeph">SQLPutData()</samp> after
calling <samp class="codeph">SQLParamData()</samp> on a statement in the SQL_NEED_DATA
state to supply the data values for an SQL_DATA_AT_EXEC parameter. Long data
can be sent in pieces through repeated calls to <samp class="codeph">SQLPutData()</samp>.
After all the pieces of data for the parameter have been sent, the application
again calls <samp class="codeph">SQLParamData()</samp>. <samp class="codeph">SQLParamData()</samp>.
proceeds to the next SQL_DATA_AT_EXEC parameter, or, if all parameters have
data values, executes the statement.</p>
<p><samp class="codeph">SQLPutData()</samp> cannot
be called more than once for a fixed length parameter.</p>
<p>After an <samp class="codeph">SQLPutData()</samp> call,
the only legal function calls are <samp class="codeph">SQLParamData(), SQLCancel()</samp>,
or another <samp class="codeph">SQLPutData()</samp> if the input data is character or
binary data. As with <samp class="codeph">SQLParamData()</samp>, all other function calls
using this statement handle fail. In addition, all function calls referencing
the parent <em>hdbc</em> of <em>hstmt</em> fail if they involve changing any attribute
or state of that connection. For a list of these functions, see the <samp class="codeph">Usage</samp> section
for <a href="rzadpfnparad.htm#rzadpfnparad">SQLParamData - Get next parameter for which a data value is needed</a>.</p>
<p>If one or more
calls to <samp class="codeph">SQLPutData()</samp> for a single parameter result in SQL_SUCCESS,
attempting to call <samp class="codeph">SQLPutData()</samp> with <em>cbValue</em> set to
SQL_NULL_DATA for the same parameter results in an error with SQLSTATE of <strong>HY</strong>011.
This error does not result in a change of state; the statement handle is still
in a <em>Need Data</em> state and the application can continue sending parameter
data.</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>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Diagnostics</h4><div class="p">Some of the following diagnostics conditions
might be reported on the final <samp class="codeph">SQLParamData()</samp> call rather
than at the time the <samp class="codeph">SQLPutData()</samp> is called.
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 2. SQLPutData SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="top" width="25%" id="d0e217">SQLSTATE</th>
<th align="left" valign="top" width="25%" id="d0e219">Description</th>
<th align="left" valign="top" width="50%" id="d0e221">Explanation</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="25%" headers="d0e217 "><strong>22</strong>001</td>
<td align="left" valign="top" width="25%" headers="d0e219 ">Too much data</td>
<td align="left" valign="top" width="50%" headers="d0e221 ">The size of the data supplied to the current
parameter by <samp class="codeph">SQLPutData()</samp> exceeds the size of the parameter.
The data supplied by the last call to <samp class="codeph">SQLPutData()</samp> is ignored.</td>
</tr>
<tr><td align="left" valign="top" width="25%" headers="d0e217 "><strong>01</strong>004</td>
<td align="left" valign="top" width="25%" headers="d0e219 ">Data truncated</td>
<td align="left" valign="top" width="50%" headers="d0e221 ">The data sent for a numeric parameter is
truncated without the loss of significant digits. <p>Timestamp data sent
for a date or time column is truncated.</p>
<p>Function returns with SQL_SUCCESS_WITH_INFO.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="25%" headers="d0e217 "><strong>HY</strong>001</td>
<td align="left" valign="top" width="25%" headers="d0e219 ">Memory allocation failure</td>
<td align="left" valign="top" width="50%" headers="d0e221 ">The driver is unable to allocate memory required
to support the processing or completion of the function.</td>
</tr>
<tr><td align="left" valign="top" width="25%" headers="d0e217 "><strong>HY</strong>009</td>
<td align="left" valign="top" width="25%" headers="d0e219 ">Argument value that is not valid</td>
<td align="left" valign="top" width="50%" headers="d0e221 ">The argument <em>rgbValue</em> is a null pointer.
<p>The argument <em>rgbValue</em> is not a NULL pointer and the argument <em>cbValue</em> is
less than 0, but not equal to SQL_NTS or SQL_NULL_DATA.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="25%" headers="d0e217 "><strong>HY</strong>010</td>
<td align="left" valign="top" width="25%" headers="d0e219 ">Function sequence error</td>
<td align="left" valign="top" width="50%" headers="d0e221 ">The statement handle <em>hstmt</em> must be
in a <em>need data</em> state and must have been positioned on an SQL_DATA_AT_EXEC
parameter through a previous <samp class="codeph">SQLParamData()</samp> call.</td>
</tr>
</tbody>
</table>
</div>
</div>
</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>