⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 io_methods.html

📁 嵌入式数据库sqlite 3.5.9的文档
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>OS Interface File Virtual Methods Object</title><style type="text/css">body {    margin: auto;    font-family: "Verdana" "sans-serif";    padding: 8px 1%;}a { color: #45735f }a:visited { color: #734559 }.logo { position:absolute; margin:3px; }.tagline {  float:right;  text-align:right;  font-style:italic;  width:240px;  margin:12px;  margin-top:58px;}.toolbar {  font-variant: small-caps;  text-align: center;  line-height: 1.6em;  margin: 0;  padding:1px 8px;}.toolbar a { color: white; text-decoration: none; padding: 6px 12px; }.toolbar a:visited { color: white; }.toolbar a:hover { color: #80a796; background: white; }.content    { margin: 5%; }.content dt { font-weight:bold; }.content dd { margin-bottom: 25px; margin-left:20%; }.content ul { padding:0px; padding-left: 15px; margin:0px; }/* rounded corners */.se  { background: url(../images/se.png) 100% 100% no-repeat #80a796}.sw  { background: url(../images/sw.png) 0% 100% no-repeat }.ne  { background: url(../images/ne.png) 100% 0% no-repeat }.nw  { background: url(../images/nw.png) 0% 0% no-repeat }</style><meta http-equiv="content-type" content="text/html; charset=UTF-8">  </head><body><div><!-- container div to satisfy validator --><a href="../index.html"><img class="logo" src="../images/SQLite.gif" alt="SQLite Logo" border="0"></a><div><!-- IE hack to prevent disappearing logo--></div><div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div><table width=100% style="clear:both"><tr><td>  <div class="se"><div class="sw"><div class="ne"><div class="nw">  <div class="toolbar">    <a href="../about.html">About</a>    <a href="../sitemap.html">Sitemap</a>    <a href="../docs.html">Documentation</a>    <a href="../download.html">Download</a>    <a href="../copyright.html">License</a>    <a href="../news.html">News</a>    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>    <a href="../support.html">Support</a>  </div></div></div></div></div></td></tr></table>  <a href="intro.html"><h2>SQLite C Interface</h2></a><h2>OS Interface File Virtual Methods Object</h2><blockquote><pre>typedef struct sqlite3_io_methods sqlite3_io_methods;struct sqlite3_io_methods {  int iVersion;  int (*xClose)(sqlite3_file*);  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);  int (*xSync)(sqlite3_file*, int flags);  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);  int (*xLock)(sqlite3_file*, int);  int (*xUnlock)(sqlite3_file*, int);  int (*xCheckReservedLock)(sqlite3_file*);  int (*xFileControl)(sqlite3_file*, int op, void *pArg);  int (*xSectorSize)(sqlite3_file*);  int (*xDeviceCharacteristics)(sqlite3_file*);  /* Additional methods may be added in future releases */};</pre></blockquote><p>Every file opened by the <a href="../c3ref/vfs.html">sqlite3_vfs</a> xOpen method contains a pointer toan instance of this object.  This object defines themethods used to perform various operations against the open file.</p><p>The flags argument to xSync may be one of <a href="../c3ref/c_sync_dataonly.html">SQLITE_SYNC_NORMAL</a> or<a href="../c3ref/c_sync_dataonly.html">SQLITE_SYNC_FULL</a>.  The first choice is the normal fsync().OS-X style fullsync.  The SQLITE_SYNC_DATA flag may be ORed in toindicate that only the data of the file and not its inode needs to besynced.</p><p>The integer values to xLock() and xUnlock() are one of<ul><li> <a href="../c3ref/c_lock_exclusive.html">SQLITE_LOCK_NONE</a>,<li> <a href="../c3ref/c_lock_exclusive.html">SQLITE_LOCK_SHARED</a>,<li> <a href="../c3ref/c_lock_exclusive.html">SQLITE_LOCK_RESERVED</a>,<li> <a href="../c3ref/c_lock_exclusive.html">SQLITE_LOCK_PENDING</a>, or<li> <a href="../c3ref/c_lock_exclusive.html">SQLITE_LOCK_EXCLUSIVE</a>.</ul>xLock() increases the lock. xUnlock() decreases the lock.The xCheckReservedLock() method looksto see if any database connection, either in thisprocess or in some other process, is holding an RESERVED,PENDING, or EXCLUSIVE lock on the file.  It returns trueif such a lock exists and false if not.</p><p>The xFileControl() method is a generic interface that allows customVFS implementations to directly control an open file using the<a href="../c3ref/file_control.html">sqlite3_file_control()</a> interface.  The second "op" argumentis an integer opcode.   The thirdargument is a generic pointer which is intended to be a pointerto a structure that may contain arguments or space in which towrite return values.  Potential uses for xFileControl() might befunctions to enable blocking locks with timeouts, to change thelocking strategy (for example to use dot-file locks), to inquireabout the status of a lock, or to break stale locks.  The SQLitecore reserves opcodes less than 100 for its own use.A <a href="../c3ref/c_fcntl_lockstate.html">list of opcodes</a> less than 100 is available.Applications that define a custom xFileControl method should use opcodesgreater than 100 to avoid conflicts.</p><p>The xSectorSize() method returns the sector size of thedevice that underlies the file.  The sector size is theminimum write that can be performed without disturbingother bytes in the file.  The xDeviceCharacteristics()method returns a bit vector describing behaviors of theunderlying device:</p><p><ul><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC512</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC1K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC2K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC4K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC8K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC16K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC32K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_ATOMIC64K</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_SAFE_APPEND</a><li> <a href="../c3ref/c_iocap_atomic.html">SQLITE_IOCAP_SEQUENTIAL</a></ul></p><p>The SQLITE_IOCAP_ATOMIC property means that all writes ofany size are atomic.  The SQLITE_IOCAP_ATOMICnnn valuesmean that writes of blocks that are nnn bytes in size andare aligned to an address which is an integer multiple ofnnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value meansthat when data is appended to a file, the data is appendedfirst then the size of the file is extended, never the otherway around.  The SQLITE_IOCAP_SEQUENTIAL property means thatinformation is written to disk in the same order as callsto xWrite().</p><p>See also lists of  <a href="objlist.html">Objects</a>,  <a href="constlist.html">Constants</a>, and  <a href="funclist.html">Functions</a>.</p><hr><small><i>This page last modified 2008/05/12 13:08:44 UTC</i></small></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -