mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
240 lines
8.4 KiB
HTML
240 lines
8.4 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>DBC->db_stream()</title>
|
||
<link rel="stylesheet" href="apiReference.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Berkeley DB C API Reference" />
|
||
<link rel="up" href="blob.html" title="Chapter 13. External Files" />
|
||
<link rel="prev" href="set_blob_threshold.html" title="DB->set_ext_file_threshold()" />
|
||
<link rel="next" href="dbstream_close.html" title="DB_STREAM->close()" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 18.1.40</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center">
|
||
<span xmlns="http://www.w3.org/1999/xhtml">DBC->db_stream()</span>
|
||
|
||
</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="set_blob_threshold.html">Prev</a> </td>
|
||
<th width="60%" align="center">Chapter 13.
|
||
External Files
|
||
</th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="dbstream_close.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="dbstream"></a>
|
||
<span>DBC->db_stream()</span>
|
||
|
||
</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<pre class="programlisting">#include <db.h>
|
||
|
||
int
|
||
DBC->db_stream(DBC *dbc, DB_STREAM **dbs, u_int32_t flags); </pre>
|
||
<p>
|
||
The <code class="methodname">DBcursor->db_stream()</code> method points to a
|
||
key/value pair where the data item is an external file.
|
||
Use the <span class="bold"><strong>flags</strong></span> parameter
|
||
to indicate whether the stream is to be opened for reading, or for
|
||
reading and writing.
|
||
</p>
|
||
<p>
|
||
Once the stream is opened, you read it using <a class="xref" href="dbstream_read.html" title="DB_STREAM->read()">
|
||
<span>DB_STREAM->read()</span>
|
||
|
||
</a>, and
|
||
you write to it using <a class="xref" href="dbstream_write.html" title="DB_STREAM->write()">
|
||
<span>DB_STREAM->write()</span>
|
||
|
||
</a>.
|
||
</p>
|
||
<p>
|
||
Close this stream using <a class="xref" href="dbstream_close.html" title="DB_STREAM->close()">
|
||
<span>DB_STREAM->close()</span>
|
||
|
||
</a>.
|
||
</p>
|
||
<p>
|
||
If the data item is not an external file, this method returns an
|
||
error.
|
||
</p>
|
||
<p>
|
||
Unless otherwise specified, the
|
||
<code class="methodname">DBcursor->db_stream()</code> <span>
|
||
<span>
|
||
method returns a non-zero error value on failure and 0 on success.
|
||
</span>
|
||
|
||
</span>
|
||
</p>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795521360"></a>Parameters</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795519664"></a>dbs</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>dbs</strong></span>
|
||
parameter references memory into which is copied the newly
|
||
opened stream.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795528960"></a>flags</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>flags</strong></span> parameter
|
||
must be set by bitwise inclusively
|
||
<span class="bold"><strong>OR</strong></span>'ing together one or more
|
||
of the following values:
|
||
</p>
|
||
<div class="itemizedlist">
|
||
<ul type="disc">
|
||
<li>
|
||
<p><a id="blobs_DB_STREAM_READ"></a>
|
||
<code class="literal">DB_STREAM_READ</code>
|
||
</p>
|
||
<p>
|
||
Indicates that the stream is to be opened for
|
||
read-only access.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p><a id="blobs_DB_STREAM_WRITE"></a>
|
||
<code class="literal">DB_STREAM_WRITE</code>
|
||
</p>
|
||
<p>
|
||
Indicates that the stream is to be opened for
|
||
read write access. The stream is sync'd to disc when
|
||
the stream is closed.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p><a id="blobs_DB_STREAM_SYNC_WRITE"></a>
|
||
<code class="literal">DB_STREAM_SYNC_WRITE</code>
|
||
</p>
|
||
<p>
|
||
Indicates that the stream is to be opened for
|
||
read and write access. The stream is sync'd to disc
|
||
after each write, instead of when the stream is closed.
|
||
</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795519120"></a>Errors</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <code class="methodname">DBcursor->db_stream()</code> <span>
|
||
<span>
|
||
method may fail and return one of the following non-zero errors:
|
||
</span>
|
||
|
||
</span>
|
||
</p>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795481456"></a>EINVAL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
If the data item is not an external file; or if an invalid flag
|
||
or parameter is specified.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795484032"></a>Class</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="link" href="dbc.html" title="Chapter 3. The DBcursor Handle">DBcursor</a>
|
||
</p>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795479376"></a>See Also</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="xref" href="blob.html#bloblist" title="External Files and Related Methods">External Files and Related Methods</a>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="set_blob_threshold.html">Prev</a> </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="u" href="blob.html">Up</a>
|
||
</td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="dbstream_close.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">
|
||
<span>DB->set_ext_file_threshold()</span>
|
||
|
||
</td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top">
|
||
<span>DB_STREAM->close()</span>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|