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

📄 vfs.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 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 Object</h2><blockquote><pre>typedef struct sqlite3_vfs sqlite3_vfs;struct sqlite3_vfs {  int iVersion;            /* Structure version number */  int szOsFile;            /* Size of subclassed sqlite3_file */  int mxPathname;          /* Maximum file pathname length */  sqlite3_vfs *pNext;      /* Next registered VFS */  const char *zName;       /* Name of this virtual file system */  void *pAppData;          /* Pointer to application-specific data */  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,               int flags, int *pOutFlags);  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags);  int (*xGetTempname)(sqlite3_vfs*, int nOut, char *zOut);  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);  void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol);  void (*xDlClose)(sqlite3_vfs*, void*);  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);  int (*xSleep)(sqlite3_vfs*, int microseconds);  int (*xCurrentTime)(sqlite3_vfs*, double*);  /* New fields may be appended in figure versions.  The iVersion  ** value will increment whenever this happens. */};</pre></blockquote><p>An instance of this object defines the interface between theSQLite core and the underlying operating system.  The "vfs"in the name of the object stands for "virtual file system".</p><p>The iVersion field is initially 1 but may be larger for futureversions of SQLite.  Additional fields may be appended to thisobject when the iVersion value is increased.</p><p>The szOsFile field is the size of the subclassed <a href="../c3ref/file.html">sqlite3_file</a>structure used by this VFS.  mxPathname is the maximum length ofa pathname in this VFS.</p><p>Registered sqlite3_vfs objects are kept on a linked list formed bythe pNext pointer.  The <a href="../c3ref/vfs_find.html">sqlite3_vfs_register()</a>and <a href="../c3ref/vfs_find.html">sqlite3_vfs_unregister()</a> interfaces manage this listin a thread-safe way.  The <a href="../c3ref/vfs_find.html">sqlite3_vfs_find()</a> interfacesearches the list.</p><p>The pNext field is the only field in the sqlite3_vfsstructure that SQLite will ever modify.  SQLite will only accessor modify this field while holding a particular static mutex.The application should never modify anything within the sqlite3_vfsobject once the object has been registered.</p><p>The zName field holds the name of the VFS module.  The name mustbe unique across all VFS modules.</p><p> SQLite will guarantee that the zFilename string passed toxOpen() is a full pathname as generated by xFullPathname() andthat the string will be valid and unchanged until xClose() iscalled. So the <a href="../c3ref/file.html">sqlite3_file</a> can store a pointer to thefilename if it needs to remember the filename for some reason.</p><p> The flags argument to xOpen() includes all bits set inthe flags argument to <a href="../c3ref/open.html">sqlite3_open_v2()</a>.  Or if <a href="../c3ref/open.html">sqlite3_open()</a>or <a href="../c3ref/open.html">sqlite3_open16()</a> is used, then flags includes at least<a href="../c3ref/c_open_create.html">SQLITE_OPEN_READWRITE</a> | <a href="../c3ref/c_open_create.html">SQLITE_OPEN_CREATE</a>.If xOpen() opens a file read-only then it sets *pOutFlags toinclude <a href="../c3ref/c_open_create.html">SQLITE_OPEN_READONLY</a>.  Other bits in *pOutFlags may beset.</p><p> SQLite will also add one of the following flags to the xOpen()call, depending on the object being opened:</p><p><ul><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_MAIN_DB</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_MAIN_JOURNAL</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_TEMP_DB</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_TEMP_JOURNAL</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_TRANSIENT_DB</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_SUBJOURNAL</a><li>  <a href="../c3ref/c_open_create.html">SQLITE_OPEN_MASTER_JOURNAL</a></ul></p><p>The file I/O implementation can use the object type flags tochanges the way it deals with files.  For example, an applicationthat does not care about crash recovery or rollback might makethe open of a journal file a no-op.  Writes to this journal wouldalso be no-ops, and any attempt to read the journal would returnSQLITE_IOERR.  Or the implementation might recognize that a databasefile will be doing page-aligned sector reads and writes in a randomorder and set up its I/O subsystem accordingly.</p><p>SQLite might also add one of the following flags to the xOpenmethod:</p><p><ul><li> <a href="../c3ref/c_open_create.html">SQLITE_OPEN_DELETEONCLOSE</a><li> <a href="../c3ref/c_open_create.html">SQLITE_OPEN_EXCLUSIVE</a></ul></p><p> The <a href="../c3ref/c_open_create.html">SQLITE_OPEN_DELETEONCLOSE</a> flag means the file should bedeleted when it is closed. The <a href="../c3ref/c_open_create.html">SQLITE_OPEN_DELETEONCLOSE</a>will be set for TEMP  databases, journals and for subjournals. The <a href="../c3ref/c_open_create.html">SQLITE_OPEN_EXCLUSIVE</a> flag means the file should be openedfor exclusive access.  This flag is set for all files exceptfor the main database file.</p><p> At least szOsFile bytes of memory are allocated by SQLiteto hold the  <a href="../c3ref/file.html">sqlite3_file</a> structure passed as the thirdargument to xOpen.  The xOpen method does not have toallocate the structure; it should just fill it in.</p><p> The flags argument to xAccess() may be <a href="../c3ref/c_access_exists.html">SQLITE_ACCESS_EXISTS</a>to test for the existance of a file,or <a href="../c3ref/c_access_exists.html">SQLITE_ACCESS_READWRITE</a> to test to seeif a file is readable and writable, or <a href="../c3ref/c_access_exists.html">SQLITE_ACCESS_READ</a>to test to see if a file is at least readable. The file can be adirectory.</p><p> SQLite will always allocate at least mxPathname+1 bytes forthe output buffers for xGetTempname and xFullPathname. The exactsize of the output buffer is also passed as a parameter to bothmethods. If the output buffer is not large enough, SQLITE_CANTOPENshould be returned. As this is handled as a fatal error by SQLite,vfs implementations should endeavor to prevent this by settingmxPathname to a sufficiently large value.</p><p>The xRandomness(), xSleep(), and xCurrentTime() interfacesare not strictly a part of the filesystem, but they areincluded in the VFS structure for completeness.The xRandomness() function attempts to return nBytes bytesof good-quality randomness into zOut.  The return value isthe actual number of bytes of randomness obtained.  ThexSleep() method causes the calling thread to sleep for atleast the number of microseconds given.  The xCurrentTime()method returns a Julian Day Number for the current date andtime.</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 + -