SQLite

Check-in [6491498085]
Login

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

Overview
Comment:Change the name of SQLITE_FCNTL_SYNC to SQLITE_FCNTL_SYNC_OMITTED and only send it when PRAGMA synchronous=OFF. Add better documentation to explain what that file-control opcode is used for.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 64914980855dbbf19512642836ca962a507b3ddb
User & Date: drh 2011-01-25 16:20:16.289
Context
2011-01-25
16:48
Make sure the return code from doing an xSync is correctly initialized so that a valid return code is produced regardless of the path taken through the logic. (check-in: f12b5d7685 user: drh tags: trunk)
16:20
Change the name of SQLITE_FCNTL_SYNC to SQLITE_FCNTL_SYNC_OMITTED and only send it when PRAGMA synchronous=OFF. Add better documentation to explain what that file-control opcode is used for. (check-in: 6491498085 user: drh tags: trunk)
13:43
Fix a couple of typos in comments. No changes to actual code. (check-in: 9167fdb356 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635


5636
5637
5638
5639
5640
5641
5642
** or pages with the Pager.noSync flag set.
**
** If successful, or if called on a pager for which it is a no-op, this
** function returns SQLITE_OK. Otherwise, an IO error code is returned.
*/
int sqlite3PagerSync(Pager *pPager){
  int rc;                              /* Return code */
  if( pPager->noSync ){
    rc = SQLITE_OK;
  }else{
    assert( !MEMDB );
    rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
  }
  if( isOpen(pPager->fd) ){
    assert( !MEMDB );
    sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, (void *)&rc);


  }
  return rc;
}

/*
** This function may only be called while a write-transaction is active in
** rollback. If the connection is in WAL mode, this call is a no-op. 







|
<
<


<
|

|
>
>







5620
5621
5622
5623
5624
5625
5626
5627


5628
5629

5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
** or pages with the Pager.noSync flag set.
**
** If successful, or if called on a pager for which it is a no-op, this
** function returns SQLITE_OK. Otherwise, an IO error code is returned.
*/
int sqlite3PagerSync(Pager *pPager){
  int rc;                              /* Return code */
  if( !pPager->noSync ){


    assert( !MEMDB );
    rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);

  }else if( isOpen(pPager->fd) ){
    assert( !MEMDB );
    sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC_OMITTED, (void *)&rc);
  }else{
    rc = SQLITE_OK;
  }
  return rc;
}

/*
** This function may only be called while a write-transaction is active in
** rollback. If the connection is in WAL mode, this call is a no-op. 
Changes to src/sqlite.h.in.
712
713
714
715
716
717
718
719
720
721
722




723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
** improve performance on some systems.
**
** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
** to the [sqlite3_file] object associated with a particular database
** connection.  See the [sqlite3_file_control()] documentation for
** additional information.
**
** The [SQLITE_FCNTL_SYNC] opcode is used internally. SQLite calls
** the file-control method with this opcode immediately after the database
** file is synced, or if the database is running in synchronous=off mode
** immediately after it would have been synced otherwise. This makes it




** easier to write special VFS modules that depend on the xSync call.
*/
#define SQLITE_FCNTL_LOCKSTATE        1
#define SQLITE_GET_LOCKPROXYFILE      2
#define SQLITE_SET_LOCKPROXYFILE      3
#define SQLITE_LAST_ERRNO             4
#define SQLITE_FCNTL_SIZE_HINT        5
#define SQLITE_FCNTL_CHUNK_SIZE       6
#define SQLITE_FCNTL_FILE_POINTER     7
#define SQLITE_FCNTL_SYNC             8


/*
** CAPI3REF: Mutex Handle
**
** The mutex module within SQLite defines [sqlite3_mutex] to be an
** abstract type for a mutex object.  The SQLite core never looks







|
|
|
|
>
>
>
>
|








|







712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
** improve performance on some systems.
**
** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
** to the [sqlite3_file] object associated with a particular database
** connection.  See the [sqlite3_file_control()] documentation for
** additional information.
**
** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
** SQLite and sent to all VFSes in place of a call to the xSync method
** when the database connection has [PRAGMA synchronous] set to OFF.)^
** Some specialized VFSes need this signal in order to operate correctly
** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most 
** VFSes do not need this signal and should silently ignore this opcode.
** Applications should not call [sqlite3_file_control()] with this
** opcode as doing so may disrupt the operation of the specilized VFSes
** that do require it.  
*/
#define SQLITE_FCNTL_LOCKSTATE        1
#define SQLITE_GET_LOCKPROXYFILE      2
#define SQLITE_SET_LOCKPROXYFILE      3
#define SQLITE_LAST_ERRNO             4
#define SQLITE_FCNTL_SIZE_HINT        5
#define SQLITE_FCNTL_CHUNK_SIZE       6
#define SQLITE_FCNTL_FILE_POINTER     7
#define SQLITE_FCNTL_SYNC_OMITTED     8


/*
** CAPI3REF: Mutex Handle
**
** The mutex module within SQLite defines [sqlite3_mutex] to be an
** abstract type for a mutex object.  The SQLite core never looks