1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Db::get_byteswapped()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> 10 <link rel="up" href="db.html" title="Chapter��2.�� The Db Handle" /> 11 <link rel="prev" href="dbget_bt_minkey.html" title="Db::get_bt_minkey()" /> 12 <link rel="next" href="dbget_cachesize.html" title="Db::get_cachesize()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Db::get_byteswapped()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbget_bt_minkey.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��2.�� 23 The Db Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="dbget_cachesize.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="dbget_byteswapped"></a>Db::get_byteswapped()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41Db::get_byteswapped(int *isswapped);</pre> 42 <p> 43 The <code class="methodname">Db::get_byteswapped()</code> method returns 44 whether the underlying database 45 files were created on an architecture of the same byte order as the 46 current one, or if they were not (that is, big-endian on a 47 little-endian machine, or vice versa). This information may be used to 48 determine whether application data needs to be adjusted for this 49 architecture or not. 50 </p> 51 <p> 52 The <code class="methodname">Db::get_byteswapped()</code> method may not be called before the 53 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> method is called. 54 </p> 55 <p> 56 The <code class="methodname">Db::get_byteswapped()</code> <span> 57 58 <span> 59 method either returns a non-zero error value or throws an 60 exception that encapsulates a non-zero error value on 61 failure, and returns 0 on success. 62 </span> 63 </span> 64 </p> 65 <div class="sect2" lang="en" xml:lang="en"> 66 <div class="titlepage"> 67 <div> 68 <div> 69 <h3 class="title"><a id="id1635512"></a>Parameters</h3> 70 </div> 71 </div> 72 </div> 73 <div class="sect3" lang="en" xml:lang="en"> 74 <div class="titlepage"> 75 <div> 76 <div> 77 <h4 class="title"><a id="id1635520"></a>isswapped</h4> 78 </div> 79 </div> 80 </div> 81 <p> 82 If the underlying database files were created on an architecture of 83 the same byte order as the current one, 0 is stored into the memory 84 location referenced by <span class="bold"><strong>isswapped</strong></span>. If 85 the underlying database files were created on an architecture of a 86 different byte order as the current one, 1 is stored into the memory 87 location referenced by <span class="bold"><strong>isswapped</strong></span>. 88 </p> 89 </div> 90 </div> 91 <div class="sect2" lang="en" xml:lang="en"> 92 <div class="titlepage"> 93 <div> 94 <div> 95 <h3 class="title"><a id="id1635560"></a>Errors</h3> 96 </div> 97 </div> 98 </div> 99 <p> 100 The <code class="methodname">Db::get_byteswapped()</code> <span> 101 102 <span> 103 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 104 exception, encapsulating one of the following non-zero errors, or return one 105 of the following non-zero errors: 106 </span> 107 </span> 108 </p> 109 <div class="sect3" lang="en" xml:lang="en"> 110 <div class="titlepage"> 111 <div> 112 <div> 113 <h4 class="title"><a id="id1635414"></a>EINVAL</h4> 114 </div> 115 </div> 116 </div> 117 <p> 118 If the method was called before <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> 119 was called; or if an invalid flag value or parameter was specified. 120 </p> 121 </div> 122 </div> 123 <div class="sect2" lang="en" xml:lang="en"> 124 <div class="titlepage"> 125 <div> 126 <div> 127 <h3 class="title"><a id="id1635655"></a>Class</h3> 128 </div> 129 </div> 130 </div> 131 <p> 132 <a class="link" href="db.html" title="Chapter��2.�� The Db Handle">Db</a> 133 </p> 134 </div> 135 <div class="sect2" lang="en" xml:lang="en"> 136 <div class="titlepage"> 137 <div> 138 <div> 139 <h3 class="title"><a id="id1635474"></a>See Also</h3> 140 </div> 141 </div> 142 </div> 143 <p> 144 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 145 </p> 146 </div> 147 </div> 148 <div class="navfooter"> 149 <hr /> 150 <table width="100%" summary="Navigation footer"> 151 <tr> 152 <td width="40%" align="left"><a accesskey="p" href="dbget_bt_minkey.html">Prev</a>��</td> 153 <td width="20%" align="center"> 154 <a accesskey="u" href="db.html">Up</a> 155 </td> 156 <td width="40%" align="right">��<a accesskey="n" href="dbget_cachesize.html">Next</a></td> 157 </tr> 158 <tr> 159 <td width="40%" align="left" valign="top">Db::get_bt_minkey()��</td> 160 <td width="20%" align="center"> 161 <a accesskey="h" href="index.html">Home</a> 162 </td> 163 <td width="40%" align="right" valign="top">��Db::get_cachesize()</td> 164 </tr> 165 </table> 166 </div> 167 </body> 168</html> 169