/usr/share/gtk-doc/html/libgda-4.0/GdaBlobOp.html is in libgda-4.0-doc 4.2.8-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Blobs</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GNOME Data Access 4 manual">
<link rel="up" href="data_models.html" title="Data handling">
<link rel="prev" href="data-select.html" title="Advanced GdaDataSelect usage">
<link rel="next" href="GdaDataModel.html" title="GdaDataModel">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="data-select.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="data_models.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNOME Data Access 4 manual</th>
<td><a accesskey="n" href="GdaDataModel.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GdaBlobOp.synopsis" class="shortcut">Top</a>
|
<a href="#GdaBlobOp.description" class="shortcut">Description</a>
|
<a href="#GdaBlobOp.object-hierarchy" class="shortcut">Object Hierarchy</a>
</td></tr>
</table>
<div class="refentry">
<a name="GdaBlobOp"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GdaBlobOp.top_of_page"></a>Blobs</span></h2>
<p>Blobs — Binary data and BLOBs handling</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GdaBlobOp.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <libgda/gda-blob-op.h>
<a class="link" href="GdaBlobOp.html#GdaBlobOp-struct" title="GdaBlobOp">GdaBlobOp</a>;
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> <a class="link" href="GdaBlobOp.html#gda-blob-op-get-length" title="gda_blob_op_get_length ()">gda_blob_op_get_length</a> (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> <a class="link" href="GdaBlobOp.html#gda-blob-op-read" title="gda_blob_op_read ()">gda_blob_op_read</a> (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> offset</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> size</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GdaBlobOp.html#gda-blob-op-read-all" title="gda_blob_op_read_all ()">gda_blob_op_read_all</a> (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> <a class="link" href="GdaBlobOp.html#gda-blob-op-write" title="gda_blob_op_write ()">gda_blob_op_write</a> (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> offset</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GdaBlobOp.html#gda-blob-op-write-all" title="gda_blob_op_write_all ()">gda_blob_op_write_all</a> (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GdaBlobOp.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+----GdaBlobOp
</pre>
</div>
<div class="refsect1">
<a name="GdaBlobOp.description"></a><h2>Description</h2>
<p>
This object is a base class for individual database providers which support BLOB types. It supports
operations to read and write data in a BLOB value (of type GDA_BLOB_TYPE).
</p>
<p>
Libgda offers two methods to manipulate binary values as two containers: <a class="link" href="libgda-4.0-Gda-Value.html#GdaBinary">GdaBinary</a>
and <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob">GdaBlob</a>:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>When reading from a data model returned by <span class="application">Libgda</span> binary data will often be in a GdaBlob object, and the
associated <a class="link" href="GdaBlobOp.html" title="Blobs">GdaBlobOp</a> object can be used to manipulate the binary object (in a
database for example)</p></li>
<li class="listitem"><p>When the binary value is created by the user, then there is no point in using a GdaBlob as
there can not be any <a class="link" href="GdaBlobOp.html" title="Blobs">GdaBlobOp</a> object, so the GdaBinary container is
enough.</p></li>
</ul></div>
<p>
</p>
<p>
Note that a <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob">GdaBlob</a> value (the "data" attribute) will often not contain any data
(or only some part of the actual BLOB)
and that it's up to the user to use the associated <a class="link" href="GdaBlobOp.html" title="Blobs">GdaBlobOp</a> object to
"load" the data into the container (into the actual process heap).
</p>
<p>
For example to load the 1st 40 bytes of a blob:
</p>
<pre class="programlisting">
GValue *blob_value = ...
GdaBlob *blob;
blob = (GdaBlob*) gda_value_get_blob (blob_value);
gda_blob_op_read (blob->op, blob, 0, 40);
</pre>
<p>
</p>
<p>
Another example is to write the contents of a blob to a file on disk, using a special
<a class="link" href="GdaBlobOp.html" title="Blobs">GdaBlobOp</a> object (internal to <span class="application">Libgda</span> which interfaces
with a file in a filesystem):
</p>
<pre class="programlisting">
GValue *blob_value; /* value to copy from */
GValue *tmp_value;
GdaBlob *file_blob;
GValue *blob_value = ...
tmp_value = gda_value_new_blob_from_file ("MyFile.bin");
file_blob = (GdaBlob*) gda_value_get_blob (tmp_value);
if (! gda_blob_op_write_all (file_blob->op, gda_value_get_blob (blob_value))) {
/* error */
}
else {
gsize size;
size = gda_blob_op_get_length (file_blob->op);
g_print ("Wrote %s, size = %d\n", filename, size);
}
gda_value_free (tmp_value);
</pre>
<p>
</p>
<p>
For further information, see:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>the section about <a class="link" href="gen_blobs.html" title="Binary large objects (BLOBs)">Binary large objects (BLOBs)</a>'s
abstraction</p></li>
<li class="listitem"><p><a class="link" href="libgda-provider-blobop.html" title="Virtual methods for Blob operations">Virtual methods for Blob operations</a>
section for more information
about how to implement the virtual methods when creating a database provider</p></li>
</ul></div>
<p>
</p>
</div>
<div class="refsect1">
<a name="GdaBlobOp.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdaBlobOp-struct"></a><h3>GdaBlobOp</h3>
<pre class="programlisting">typedef struct _GdaBlobOp GdaBlobOp;</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-blob-op-get-length"></a><h3>gda_blob_op_get_length ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> gda_blob_op_get_length (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>);</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>an existing <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the length of the blob in bytes. In case of error, -1 is returned and the
provider should have added an error (a <a class="link" href="GdaConnectionEvent.html" title="GdaConnectionEvent"><span class="type">GdaConnectionEvent</span></a>) to the connection.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gda-blob-op-read"></a><h3>gda_blob_op_read ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> gda_blob_op_read (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> offset</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> size</code></em>);</pre>
<p>
Reads a chunk of bytes from the BLOB accessible through <em class="parameter"><code>op</code></em> into <em class="parameter"><code>blob</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>blob</code></em> :</span></p></td>
<td>a <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> to read data to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
<td>offset to read from the start of the blob (starts at 0)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>maximum number of bytes to read.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of bytes actually read. In case of error, -1 is returned and the
provider should have added an error to the connection.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gda-blob-op-read-all"></a><h3>gda_blob_op_read_all ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gda_blob_op_read_all (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>);</pre>
<p>
Reads the whole contents of the blob manipulated by <em class="parameter"><code>op</code></em> into <em class="parameter"><code>blob</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>blob</code></em> :</span></p></td>
<td>a <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> to read data to</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>TRUE if <em class="parameter"><code>blob->data</code></em> contains the whole BLOB manipulated by <em class="parameter"><code>op</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gda-blob-op-write"></a><h3>gda_blob_op_write ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="returnvalue">glong</span></a> gda_blob_op_write (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#glong"><span class="type">glong</span></a> offset</code></em>);</pre>
<p>
Writes a chunk of bytes from a <em class="parameter"><code>blob</code></em> to the BLOB accessible through <em class="parameter"><code>op</code></em>, <em class="parameter"><code>blob</code></em> is unchanged after
this call.
</p>
<p>
If <em class="parameter"><code>blob</code></em> has an associated <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> (ie. if <em class="parameter"><code>blob->op</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>) then the data to be written
using <em class="parameter"><code>op</code></em> is the data fetched using <em class="parameter"><code>blob->op</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>blob</code></em> :</span></p></td>
<td>a <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> which contains the data to write</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
<td>offset to write from the start of the blob (starts at 0)</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of bytes written. In case of error, -1 is returned and the
provider should have added an error to the connection.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gda-blob-op-write-all"></a><h3>gda_blob_op_write_all ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gda_blob_op_write_all (<em class="parameter"><code><a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a> *op</code></em>,
<em class="parameter"><code><a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> *blob</code></em>);</pre>
<p>
Writes the whole contents of <em class="parameter"><code>blob</code></em> into the blob manipulated by <em class="parameter"><code>op</code></em>. If necessary the resulting
blob is truncated from its previous length.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="GdaBlobOp.html" title="Blobs"><span class="type">GdaBlobOp</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>blob</code></em> :</span></p></td>
<td>a <a class="link" href="libgda-4.0-Gda-Value.html#GdaBlob" title="GdaBlob"><span class="type">GdaBlob</span></a> which contains the data to write</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>TRUE on success</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|