📄 blobs.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 - How To - Working with Long or Lob(CLob, BLob) data</title></head><body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--class="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>
<!--class="GlbActive"-->
<td width=70 bgcolor=#00bb00 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="GlbDefault"-->
<td width=70 bgcolor=#000094 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%" cellpadding=1 cellspacing=1>
<tr>
<td valign="top" align=left><!--class="LeftMenu"-->
<table frame="void" CELLSPACING=2 cellpadding=2 width=165>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="connect.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Connecting to databases</font></A> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="transactions.html" style ="TEXT-DECORATION: none" >
<font color="white" face="sans-serif" size=2>
Transactions</font></A> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="commands.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Executing an SQL command</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="procedures.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Executing stored procedures</A>
</FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="bind.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Binding input parameters</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="fetch.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Fetching result set</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"
>
<A href="fetch_multiple.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Fetching multiple result sets</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"
>
<A href="performance.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Optimizing Database Performance</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="return_param.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Returning output parameters</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/red.gif" WIDTH="12"
HEIGHT="12"
>
<A href="blobs.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Working with
Long or Lob(CLob, BLob) Data</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">
Working with date/time values</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="errors.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Error handling</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="query_exampl.html" style ="TEXT-DECORATION: none" >
<font color="white" size="2" face="sans-serif">
Query examples</A> </FONT> </td>
</tr>
</table>
</td>
<td width="30">
<p> </p>
</td>
<td valign="top">
<center>
<h1>Working with Long or Lob(CLob, BLob) data</h1>
</center>
<CENTER></CENTER>
<P>SQLAPI++ supports four types for working with this
kind of data (see <A href="#Server specific notes">Server specific
notes</A> later on this page for details about how SQLAPI++ maps this types on a different
SQL platforms):</P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="WIDTH: 100%"
width="100%">
<TR bgColor=navy>
<TD><FONT color=white
style="BACKGROUND-COLOR: #000080">Name</FONT></TD>
<TD><FONT color=white style="BACKGROUND-COLOR: #000080">C enum
constant</FONT></TD>
<TD><FONT color=white
style="BACKGROUND-COLOR: #000080">Description</FONT></TD></TR>
<TR>
<TD>LongBinary</TD>
<TD>SA_dtLongBinary</TD>
<TD>Generally this type is mapped to an appropriate SQL type that holds
long binary data of variable length but does NOT supports
"handle" semantics.</TD></TR>
<TR>
<TD>LongChar</TD>
<TD>SA_dtLongChar</TD>
<TD>Generally this type is mapped to an appropriate SQL type that holds long
character data of variable length but does NOT
supports "handle" semantics.</TD></TR>
<TR>
<TD>BLob (Binary Large object)</TD>
<TD>SA_dtBLob</TD>
<TD>Generally this type is mapped to an appropriate SQL type that holds large
binary data of variable length and does
supports "handle" semantics.</TD></TR>
<TR>
<TD>CLob (Character Large object)</TD>
<TD>SA_dtCLob</TD>
<TD>Generally this type is mapped to an appropriate SQL type that holds large
character data of variable length and does
supports "handle" semantics.</TD></TR></TABLE>
</P>
<P>Working with Long or Lob data assumes the
following:</P>
<UL>
<LI><A href="#Binding Long or Lob data">Binding
Long or Lob data</A> into input variables (SQL statements) or input parameters (stored procedures/functions).
<LI><A href="#Reading Long or Lob data">Reading
Long or Lob data</A> (from fields in result set or from output
parameters of stored procedure)</LI></UL>
<A name="Binding Long or Lob data"></A>
<H4>Binding Long or Lob data</H4>
<P>Suppose, we want to update BLob field named FBLOB
from table named TEST where some other field named FKEY is equal
to 'KEY' (<EM>Update TEST set FBLOB = :fblob where FKEY =
'KEY' </EM> ). Field
should be updated with the content of a file named 'blob.bin'.</P>
<P>As usual, the first thing to do is to create the
objects.<BR><STRONG><FONT face="" size=2><FONT face=System><FONT size=+0>SACommand
cmd(&Connection, "Update TEST set FBLOB =
:fblob where FKEY =
'KEY' ");<BR>
</FONT></FONT></FONT></STRONG>For more
information see <A href="connect.html">Connecting to databases</A>.
</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -