📄 value_writelongorlob.html
字号:
<html><head><meta name="KEYWORDS" content=" library, C++, Oracle, SQLServer, DB2, Sybase, Informix, InterBase, SQLBase, ODBC,
SQL, server, client, database, programming, development, software,
Win32, Windows, Linux, Unix, Solaris,
Microsoft, Borland, Centura, Gupta, IBM"><meta name="DESCRIPTION" content=
"SQLAPI++ is C++ library for accessing SQL databases (Oracle, SQLServer, Sybase, DB2, InterBase, SQLBase, Informix, ODBC).
It uses native APIs, provides low-level access to database-specific features."><title>SQLAPI++ Library - Online Documentation - Writing Long or Lob parameters value</title></head><body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--GlbHdr--> <table WIDTH="600" height="40" frame="hsides" BORDER="2" BORDERCOLOR="#004fcd" align="right" cellpadding="0" cellspacing="2" id="TABLE1">
<tr><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="/index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Home</b></font></A></td></TD>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="/HowTo/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>How To</b></font></A></td><!--class="GlbActive"-->
<td width="70" bgcolor="#00bb00" bordercolor="black" align="middle"><A href="/OnLineDoc/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Online Documentation</b></font></A></td><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="/Support/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Support</b></font></A></td>
<td width=70 bgcolor=#000094 bordercolor=black align=middle> <A href="/Download/index.html" style="TEXT-DECORATION: none" >
<font color=white size=3 face=sans-serif>
<b>Download</b></font></A></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="/Order/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Order</b></font></A></td> </tr>
</table>
<p> </p>
<p> </p>
<table width="100%">
<tr>
<td valign="top" width="165"><!--LeftMenu-->
<table frame="void" CELLSPACING="5" width="165">
<tr><td><p> </p></td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"> <A href="Command.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SACommand</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"> <A href="Connection.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAConnection</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"> <A href="Exception.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAException</font></A> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"> <A href="Field.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAField</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"> <A href="Param.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAParam</A> </FONT> </td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="String.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
SAString</A> </FONT> </td>
</tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="DateTime.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
SADateTime</A> </FONT> </td>
</tr>
</table>
</td><!--empty column-->
<td width="20">
<p> </p>
</td><!--Content-->
<td valign="top" align="left">
<table width="100%" cellspacing="2" cellpadding="2">
<tr>
<td align="left"> <A href="Param_Usage.html" style="TEXT-DECORATION: none"><h3>Usage</h3></A>
</td>
<td align="left"> <A href="Param.html" style="TEXT-DECORATION: none"><h3>Class Members</h3></A>
</td>
<td align="left"> <A href="Param_Examples.html" style="TEXT-DECORATION: none"><h3>Examples</h3></A>
</td>
</tr>
<tr>
<td colspan="3">
<P>There are four methods of <STRONG>SAValue</STRONG>
class to write Long or BLob(CLob) parameters value using
user defined callback:</P></td>
</tr>
</table><font face="Arial"><STRONG>
<p><font face=Arial><STRONG>SAString &setAsLongBinary(
saLongOrLobWriter_t </STRONG>
</STRONG>fnWriter<STRONG><STRONG> = saDefaultLongOrLobWriter,
unsigned int </STRONG>
</STRONG>nWriterSize<STRONG><STRONG> = 0, void
*</STRONG>
</STRONG>pAddlData<STRONG><STRONG
> = NULL);</STRONG><STRONG><BR>throw
(SAException);</STRONG></font></P>
<p><font face=Arial><STRONG></STRONG></font>SAString
&setAsLongChar( saLongOrLobWriter_t </STRONG>fnWriter<STRONG> = saDefaultLongOrLobWriter,
unsigned int</STRONG>nWriterSize<STRONG> = 0,
void *</STRONG>pAddlData<STRONG> =
NULL);<BR>
</STRONG><STRONG>throw (SAException);</STRONG></p>
<p><STRONG></STRONG><STRONG>SAString
&setAsBLob( saLongOrLobWriter_t </STRONG>fnWriter<STRONG> =
saDefaultLongOrLobWriter, unsigned int </STRONG>nWriterSize<STRONG>
= 0, void *</STRONG>pAddlData<STRONG> =
NULL);<BR></STRONG><STRONG>throw (SAException);</STRONG></p>
<p><STRONG></STRONG><STRONG>SAString
&setAsCLob( saLongOrLobWriter_t </STRONG>fnWriter<STRONG> =
saDefaultLongOrLobWriter, unsigned int </STRONG>nWriterSize<STRONG>
= 0, void *</STRONG>pAddlData<STRONG> =
NULL);<BR></STRONG><STRONG>throw (SAException);</STRONG></p></FONT>
<H3>Parameters</H3>
<P><EM>fnWriter</EM>. The name of user function
used for Long or BLob(CLob) data writing. The function must have
syntax declared by <STRONG>saLongOrLobWriter_t
typedef</STRONG>. The default value is
<STRONG>saDefaultLongOrLobWriter</STRONG>. If you use the default value, SQLAPI++
Library will write Long or Lob data from internal buffer without calling
user-defined callback. </P>
<P><EM>nWriterSize</EM>. Size of piece of data user want to use
for piecewise writing. The default value is <STRONG>0</STRONG> .
If you use the default value, SQLAPI++ Library will
automatically use the most appropriate size for current DBMS. </P>
<P><EM>pAddData</EM>. Additional data that you want to pass to
callback function.</P>
<h3>Remarks</h3>
<P>When you call <A href="Command_Execute.html" >SACommand::Execute</A> method all input
parameters are bound with their values, including Long and
BLob(CLob) parameters. If you want to control piecewise writing of
Long or BLob(CLob) data you should do the following: before a
command execution call one of the describing methods
(<STRONG>setAsLongBinary</STRONG> method to write Long Binary data,
<STRONG>setAsLongChar</STRONG> method to write Long Character data,
<STRONG>setAsBLob</STRONG> method to write BLob data,
<STRONG>setAsCLob</STRONG> method to write CLob data) with
<EM>fnWriter</EM> parameter which differs from the default value
<STRONG>saDefaultLongOrLobWriter</STRONG> for Long or BLob(CLob)
parameters you want to process by user defined
function(s). </P>
<P>Each of four methods will repeatedly call
user defined function:</P>
<P><FONT face=System>void
<function Name>(SAPieceType_t &ePieceType, <BR
>
void *pBuf, <BR>
unsigned int nLen, <BR>
void *pAddlData);</FONT></P>
<P><STRONG></STRONG>User
defined function has the following parameters:</P>
<P><EM>ePieceType</EM>. Parameter defines which
piece of data value was written. Can be one of the next <STRONG
>SAPieceType_t</STRONG> enum values:</P>
<UL>
<LI><STRONG>SA_FirstPiece</STRONG> The first (but not the
last) piece of data is to be written.
<LI><STRONG>SA_NextPiece</STRONG> The next (not the first and
not the last) piece of data is to be written.
<LI><STRONG>SA_LastPiece</STRONG> The last piece of data is
to be written.
<LI><STRONG>SA_OnePiece</STRONG> All parameter data is to
be written as one block.</LI></UL>
<P><EM>pBuf</EM>. Pointer to the buffer that
contains the data block to write to database.</P>
<P><EM>nLen</EM>. The actual size of data in bufer
<EM>pBuf</EM>.</P>
<P><EM>pAddData</EM>
. An additional data.</P>
<P>To get more information about writing Long
and BLob(CLob) data see <A href="../Examples/step5.cpp" >Query examples - Step 5</A>.
</P>
<h3>Server specific notes</h3>
<P>No specific information.</P>
<h3>Problems and Questions</h3>
<p> If
you don't find the answer to you questions or
have some problems on using the Library, please, send e-mail to <A href="mailto:howto@sqlapi.com">howto@sqlapi.com</A>.
</p>
</td>
<tr></tr>
</table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -