/ Check-in [47064453]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Identify additional requirements in the sqlite3_vfs object documentation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 47064453c396d5204a851b8ec08d665e2b12228a
User & Date: drh 2010-09-01 19:29:57
Context
2010-09-02
04:30
Fix a few typos. Update evidence marks. check-in: c90a68b7 user: shaneh tags: trunk
2010-09-01
19:29
Identify additional requirements in the sqlite3_vfs object documentation. check-in: 47064453 user: drh tags: trunk
18:00
Add tests to quota.test. check-in: ec9af6eb user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os.c.

   179    179     return pVfs->xRandomness(pVfs, nByte, zBufOut);
   180    180   }
   181    181   int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
   182    182     return pVfs->xSleep(pVfs, nMicro);
   183    183   }
   184    184   int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
   185    185     int rc;
          186  +  /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64()
          187  +  ** method to get the current date and time if that method is available
          188  +  ** (if iVersion is 2 or greater and the function pointer is not NULL) and
          189  +  ** will fall back to xCurrentTime() if xCurrentTimeInt64() is
          190  +  ** unavailable.
          191  +  */
   186    192     if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
   187    193       rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);
   188    194     }else{
   189    195       double r;
   190    196       rc = pVfs->xCurrentTime(pVfs, &r);
   191    197       *pTimeOut = (sqlite3_int64)(r*86400000.0);
   192    198     }

Changes to src/sqlite.h.in.

   748    748   ** or modify this field while holding a particular static mutex.
   749    749   ** The application should never modify anything within the sqlite3_vfs
   750    750   ** object once the object has been registered.
   751    751   **
   752    752   ** The zName field holds the name of the VFS module.  The name must
   753    753   ** be unique across all VFS modules.
   754    754   **
   755         -** SQLite will guarantee that the zFilename parameter to xOpen
          755  +** ^SQLite will guarantee that the zFilename parameter to xOpen
   756    756   ** is either a NULL pointer or string obtained
   757         -** from xFullPathname().  SQLite further guarantees that
          757  +** from xFullPathname().  ^SQLite further guarantees that
   758    758   ** the string will be valid and unchanged until xClose() is
   759    759   ** called. Because of the previous sentence,
   760    760   ** the [sqlite3_file] can safely store a pointer to the
   761    761   ** filename if it needs to remember the filename for some reason.
   762         -** If the zFilename parameter is xOpen is a NULL pointer then xOpen
   763         -** must invent its own temporary name for the file.  Whenever the 
          762  +** If the zFilename parameter to xOpen is a NULL pointer then xOpen
          763  +** must invent its own temporary name for the file.  ^Whenever the 
   764    764   ** xFilename parameter is NULL it will also be the case that the
   765    765   ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
   766    766   **
   767    767   ** The flags argument to xOpen() includes all bits set in
   768    768   ** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
   769    769   ** or [sqlite3_open16()] is used, then flags includes at least
   770    770   ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. 
   771    771   ** If xOpen() opens a file read-only then it sets *pOutFlags to
   772    772   ** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
   773    773   **
   774         -** SQLite will also add one of the following flags to the xOpen()
          774  +** ^(SQLite will also add one of the following flags to the xOpen()
   775    775   ** call, depending on the object being opened:
   776    776   **
   777    777   ** <ul>
   778    778   ** <li>  [SQLITE_OPEN_MAIN_DB]
   779    779   ** <li>  [SQLITE_OPEN_MAIN_JOURNAL]
   780    780   ** <li>  [SQLITE_OPEN_TEMP_DB]
   781    781   ** <li>  [SQLITE_OPEN_TEMP_JOURNAL]
   782    782   ** <li>  [SQLITE_OPEN_TRANSIENT_DB]
   783    783   ** <li>  [SQLITE_OPEN_SUBJOURNAL]
   784    784   ** <li>  [SQLITE_OPEN_MASTER_JOURNAL]
   785         -** </ul>
          785  +** <li>  [SQLITE_OPEN_WAL]
          786  +** </ul>)^
   786    787   **
   787    788   ** The file I/O implementation can use the object type flags to
   788    789   ** change the way it deals with files.  For example, an application
   789    790   ** that does not care about crash recovery or rollback might make
   790    791   ** the open of a journal file a no-op.  Writes to this journal would
   791    792   ** also be no-ops, and any attempt to read the journal would return
   792    793   ** SQLITE_IOERR.  Or the implementation might recognize that a database
................................................................................
   797    798   **
   798    799   ** <ul>
   799    800   ** <li> [SQLITE_OPEN_DELETEONCLOSE]
   800    801   ** <li> [SQLITE_OPEN_EXCLUSIVE]
   801    802   ** </ul>
   802    803   **
   803    804   ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
   804         -** deleted when it is closed.  The [SQLITE_OPEN_DELETEONCLOSE]
   805         -** will be set for TEMP  databases, journals and for subjournals.
          805  +** deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
          806  +** will be set for TEMP databases and their journals, transient
          807  +** databases, and subjournals.
   806    808   **
   807         -** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
          809  +** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
   808    810   ** with the [SQLITE_OPEN_CREATE] flag, which are both directly
   809    811   ** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
   810    812   ** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
   811    813   ** SQLITE_OPEN_CREATE, is used to indicate that file should always
   812    814   ** be created, and that it is an error if it already exists.
   813    815   ** It is <i>not</i> used to indicate the file should be opened 
   814    816   ** for exclusive access.
   815    817   **
   816         -** At least szOsFile bytes of memory are allocated by SQLite
          818  +** ^At least szOsFile bytes of memory are allocated by SQLite
   817    819   ** to hold the  [sqlite3_file] structure passed as the third
   818    820   ** argument to xOpen.  The xOpen method does not have to
   819    821   ** allocate the structure; it should just fill it in.  Note that
   820    822   ** the xOpen method must set the sqlite3_file.pMethods to either
   821    823   ** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
   822    824   ** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
   823    825   ** element will be valid after xOpen returns regardless of the success
   824    826   ** or failure of the xOpen call.
   825    827   **
   826         -** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
          828  +** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
   827    829   ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
   828    830   ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
   829    831   ** to test whether a file is at least readable.   The file can be a
   830    832   ** directory.
   831    833   **
   832         -** SQLite will always allocate at least mxPathname+1 bytes for the
          834  +** ^SQLite will always allocate at least mxPathname+1 bytes for the
   833    835   ** output buffer xFullPathname.  The exact size of the output buffer
   834    836   ** is also passed as a parameter to both  methods. If the output buffer
   835    837   ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
   836    838   ** handled as a fatal error by SQLite, vfs implementations should endeavor
   837    839   ** to prevent this by setting mxPathname to a sufficiently large value.
   838    840   **
   839    841   ** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
   840    842   ** interfaces are not strictly a part of the filesystem, but they are
   841    843   ** included in the VFS structure for completeness.
   842    844   ** The xRandomness() function attempts to return nBytes bytes
   843    845   ** of good-quality randomness into zOut.  The return value is
   844    846   ** the actual number of bytes of randomness obtained.
   845    847   ** The xSleep() method causes the calling thread to sleep for at
   846         -** least the number of microseconds given.  The xCurrentTime()
          848  +** least the number of microseconds given.  ^The xCurrentTime()
   847    849   ** method returns a Julian Day Number for the current date and time as
   848    850   ** a floating point value.
   849         -** The xCurrentTimeInt64() method returns, as an integer, the Julian
          851  +** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
   850    852   ** Day Number multipled by 86400000 (the number of milliseconds in 
   851    853   ** a 24-hour day).  
   852    854   ** ^SQLite will use the xCurrentTimeInt64() method to get the current
   853    855   ** date and time if that method is available (if iVersion is 2 or 
   854    856   ** greater and the function pointer is not NULL) and will fall back
   855    857   ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
   856    858   */