159 lines
8.6 KiB
HTML
159 lines
8.6 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="Graphic host variables in C and C++ applications that use SQL" />
|
|||
|
<meta name="abstract" content="There are three valid forms for graphic host variables." />
|
|||
|
<meta name="description" content="There are three valid forms for graphic host variables." />
|
|||
|
<meta name="DC.subject" content="graphic host variable, C, C++, host variable, graphic, C program, C++ program, precompiler command, CRTSQLCI, CRTSQLCPPI, precompiler parameter, OPTION(*CNULRQD), OPTION(*NOCNULRQD), declaring" />
|
|||
|
<meta name="keywords" content="graphic host variable, C, C++, host variable, graphic, C program, C++ program, precompiler command, CRTSQLCI, CRTSQLCPPI, precompiler parameter, OPTION(*CNULRQD), OPTION(*NOCNULRQD), declaring" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rzajpdeclaringhostc.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="rzajpcgraphvar" />
|
|||
|
<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>Graphic host variables in C and C++ applications that use SQL</title>
|
|||
|
</head>
|
|||
|
<body id="rzajpcgraphvar"><a name="rzajpcgraphvar"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Graphic host variables in C and C++ applications that use SQL</h1>
|
|||
|
<div><p>There are three valid forms for graphic host variables. </p>
|
|||
|
<div class="section"><ul><li>Single-graphic form</li>
|
|||
|
<li>NUL-terminated graphic form</li>
|
|||
|
<li>VARGRAPHIC structured form</li>
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
<div class="section"><h4 class="sectiontitle">Single-graphic form</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcgraphvarsyn1.htm" /></span><a href="#d0e80"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
|
|||
|
>>-+--------+--+----------+--wchar_t---------------------------->
|
|||
|
+-auto---+ +-const----+
|
|||
|
+-extern-+ '-volatile-'
|
|||
|
'-static-'
|
|||
|
|
|||
|
.-,----------------------------------.
|
|||
|
V |
|
|||
|
>----<i>variable-name</i>--+-----------------+-+-- ; -----------------><
|
|||
|
'- = --<i>expression</i>-'
|
|||
|
|
|||
|
</pre><a name="d0e80"></a></div>
|
|||
|
<div class="section"><h4 class="sectiontitle">NUL-Terminated graphic form</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcgraphvarsyn2.htm" /></span><a href="#d0e112"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
|
|||
|
>>-+--------+--+----------+--wchar_t---------------------------->
|
|||
|
+-auto---+ +-const----+
|
|||
|
+-extern-+ '-volatile-'
|
|||
|
'-static-'
|
|||
|
|
|||
|
.-,------------------------------------------------.
|
|||
|
V |
|
|||
|
>----<i>variable-name</i>--[--<i>length</i>--]--+-----------------+-+-- ; ---><
|
|||
|
'- = --<i>expression</i>-'
|
|||
|
|
|||
|
</pre><a name="d0e112"></a></div>
|
|||
|
<div class="section"> <div class="note"><span class="notetitle">Notes:</span> <ol><li><em>length</em> must be an integer constant that is greater than 1 and not
|
|||
|
greater than 16371.</li>
|
|||
|
<li>If the *CNULRQD option is specified on the <span class="cmdname">CRTSQLCI</span> or <span class="cmdname">CRTSQLCPPI</span> command,
|
|||
|
then input host variables must contain the graphic NUL-terminator (/0/0).
|
|||
|
Output host variables are padded with DBCS blanks, and the last character
|
|||
|
is the graphic NUL-terminator. If the output host variable is too small to
|
|||
|
contain both the data and the NUL-terminator, the following actions are taken:
|
|||
|
<ul><li>The data is truncated</li>
|
|||
|
<li>The last character is the graphic NUL-terminator</li>
|
|||
|
<li>SQLWARN1 is set to 'W'</li>
|
|||
|
</ul>
|
|||
|
<div class="p">If the *NOCNULRQD option is specified on the <span class="cmdname">CRTSQLCI</span> or <span class="cmdname">CRTSQLCPPI</span> command,
|
|||
|
the input host variables do not need to contain the graphic NUL-terminator.
|
|||
|
The following is true for output host variables. <ul><li>If the host variable is large enough to contain the data and the graphic
|
|||
|
NUL-terminator, the following actions are taken: <ul><li>The data is returned, but is not padded with DBCS blanks</li>
|
|||
|
<li>The graphic NUL-terminator immediately follows the data</li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li>If the host variable is large enough to contain the data but not the graphic
|
|||
|
NUL-terminator, the following actions are taken: <ul><li>The data is returned</li>
|
|||
|
<li>A graphic NUL-terminator is not returned</li>
|
|||
|
<li>SQLWARN1 is set to 'N'</li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li>If the host variable is not large enough to contain the data, the following
|
|||
|
actions are taken: <ul><li>The data is truncated</li>
|
|||
|
<li>A graphic NUL-terminator is not returned</li>
|
|||
|
<li>SQLWARN1 is set to 'W'</li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
</li>
|
|||
|
</ol>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="section"><h4 class="sectiontitle">VARGRAPHIC structured form</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcgraphvarsyn3.htm" /></span><a href="#d0e208"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
|
|||
|
>>-+--------+--+----------+------------------------------------->
|
|||
|
+-auto---+ +-const----+
|
|||
|
+-extern-+ '-volatile-'
|
|||
|
'-static-'
|
|||
|
|
|||
|
>--+---------+--struct--+-----+-- { ---------------------------->
|
|||
|
'-_Packed-' '-<i>tag</i>-'
|
|||
|
|
|||
|
.-int-.
|
|||
|
>--+--------+--short--+-----+--<i>var-1</i>-- ; ----------------------->
|
|||
|
'-signed-'
|
|||
|
|
|||
|
>--wchar_t--<i>var-2</i>--[--<i>length</i>--]-- ; -- } ----------------------->
|
|||
|
|
|||
|
.-,----------------------------------------------------.
|
|||
|
V |
|
|||
|
>----<i>variable-name</i>--+-----------------------------------+-+--;-><
|
|||
|
'-=--{--<i>expression ,</i>--<i>expression</i>--}-'
|
|||
|
|
|||
|
</pre><a name="d0e208"></a></div>
|
|||
|
<div class="section"> <div class="note"><span class="notetitle">Notes:</span> <ol><li><em>length</em> must be an integer constant that is greater than 0 and not
|
|||
|
greater than 16370.</li>
|
|||
|
<li><em>var-1</em> and <em>var-2</em> must be simple variable references and cannot
|
|||
|
be used as host variables.</li>
|
|||
|
<li>The struct tag can be used to define other data areas, but these cannot
|
|||
|
be used as host variables.</li>
|
|||
|
<li>_Packed must not be used in C++. Instead, specify #pragma pack(1) prior
|
|||
|
to the declaration and #pragma pack() after the declaration. <pre>#pragma pack(1)
|
|||
|
struct VARGRAPH {
|
|||
|
short len;
|
|||
|
wchar_t s[10];
|
|||
|
} vstring;
|
|||
|
#pragma pack()</pre>
|
|||
|
</li>
|
|||
|
</ol>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="section"><h4 class="sectiontitle"><em>Example</em></h4><pre>EXEC SQL <strong>BEGIN DECLARE SECTION</strong>;
|
|||
|
|
|||
|
/* valid declaration of host variable graphic string */
|
|||
|
|
|||
|
struct VARGRAPH {
|
|||
|
short len;
|
|||
|
wchar_t s[10];
|
|||
|
} vstring;
|
|||
|
|
|||
|
/* invalid declaration of host variable wstring */
|
|||
|
|
|||
|
struct VARGRAPH wstring;
|
|||
|
</pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpdeclaringhostc.htm" title="The C and C++ precompilers recognize only a subset of valid C and C++ declarations as valid host variable declarations.">Declare host variables in C and C++ applications that use SQL</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|