/ Check-in [6f2c72a0]
Login

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

Overview
Comment:Update all built-in VFSes to return SQLITE_OK for the SQLITE_FCNTL_SYNC_OMITTED file-control operation. Also change the xFileControl methods to return SQLITE_NOTFOUND for unrecognized operation codes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6f2c72a0f6579db3f40c079436ca40e3e52bd6d9
User & Date: drh 2011-01-26 19:46:22
Context
2011-01-27
14:35
SQLite version 3.7.5 release candidate 1 check-in: 35ac78f5 user: drh tags: trunk
2011-01-26
19:46
Update all built-in VFSes to return SQLITE_OK for the SQLITE_FCNTL_SYNC_OMITTED file-control operation. Also change the xFileControl methods to return SQLITE_NOTFOUND for unrecognized operation codes. check-in: 6f2c72a0 user: drh tags: trunk
15:23
Update test file mutex1.test to account for [e3b500fb5d]. check-in: c86e46f4 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

   812    812       /* SQLITE_BUSY        */ "database is locked",
   813    813       /* SQLITE_LOCKED      */ "database table is locked",
   814    814       /* SQLITE_NOMEM       */ "out of memory",
   815    815       /* SQLITE_READONLY    */ "attempt to write a readonly database",
   816    816       /* SQLITE_INTERRUPT   */ "interrupted",
   817    817       /* SQLITE_IOERR       */ "disk I/O error",
   818    818       /* SQLITE_CORRUPT     */ "database disk image is malformed",
   819         -    /* SQLITE_NOTFOUND    */ 0,
          819  +    /* SQLITE_NOTFOUND    */ "unknown operation",
   820    820       /* SQLITE_FULL        */ "database or disk is full",
   821    821       /* SQLITE_CANTOPEN    */ "unable to open database file",
   822    822       /* SQLITE_PROTOCOL    */ "locking protocol",
   823    823       /* SQLITE_EMPTY       */ "table contains no data",
   824    824       /* SQLITE_SCHEMA      */ "database schema has changed",
   825    825       /* SQLITE_TOOBIG      */ "string or blob too big",
   826    826       /* SQLITE_CONSTRAINT  */ "constraint failed",
................................................................................
  2360   2360         fd = sqlite3PagerFile(pPager);
  2361   2361         assert( fd!=0 );
  2362   2362         if( op==SQLITE_FCNTL_FILE_POINTER ){
  2363   2363           *(sqlite3_file**)pArg = fd;
  2364   2364           rc = SQLITE_OK;
  2365   2365         }else if( fd->pMethods ){
  2366   2366           rc = sqlite3OsFileControl(fd, op, pArg);
         2367  +      }else{
         2368  +        rc = SQLITE_NOTFOUND;
  2367   2369         }
  2368   2370         sqlite3BtreeLeave(pBtree);
  2369   2371       }
  2370   2372     }
  2371   2373     sqlite3_mutex_leave(db->mutex);
  2372   2374     return rc;   
  2373   2375   }

Changes to src/os_os2.c.

   529    529       case SQLITE_FCNTL_LOCKSTATE: {
   530    530         *(int*)pArg = ((os2File*)id)->locktype;
   531    531         OSTRACE(( "FCNTL_LOCKSTATE %d lock=%d\n",
   532    532                   ((os2File*)id)->h, ((os2File*)id)->locktype ));
   533    533         return SQLITE_OK;
   534    534       }
   535    535     }
   536         -  return SQLITE_ERROR;
          536  +  return SQLITE_NOTFOUND;
   537    537   }
   538    538   
   539    539   /*
   540    540   ** Return the sector size in bytes of the underlying block device for
   541    541   ** the specified file. This is almost always 512 bytes, but may be
   542    542   ** larger for some devices.
   543    543   **

Changes to src/os_unix.c.

  3131   3131   #endif
  3132   3132   #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
  3133   3133       case SQLITE_SET_LOCKPROXYFILE:
  3134   3134       case SQLITE_GET_LOCKPROXYFILE: {
  3135   3135         return proxyFileControl(id,op,pArg);
  3136   3136       }
  3137   3137   #endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */
         3138  +    case SQLITE_FCNTL_SYNC_OMITTED: {
         3139  +      return SQLITE_OK;  /* A no-op */
         3140  +    }
  3138   3141     }
  3139         -  return SQLITE_ERROR;
         3142  +  return SQLITE_NOTFOUND;
  3140   3143   }
  3141   3144   
  3142   3145   /*
  3143   3146   ** Return the sector size in bytes of the underlying block device for
  3144   3147   ** the specified file. This is almost always 512 bytes, but may be
  3145   3148   ** larger for some devices.
  3146   3149   **

Changes to src/os_win.c.

  1179   1179       case SQLITE_FCNTL_SIZE_HINT: {
  1180   1180         sqlite3_int64 sz = *(sqlite3_int64*)pArg;
  1181   1181         SimulateIOErrorBenign(1);
  1182   1182         winTruncate(id, sz);
  1183   1183         SimulateIOErrorBenign(0);
  1184   1184         return SQLITE_OK;
  1185   1185       }
         1186  +    case SQLITE_FCNTL_SYNC_OMITTED: {
         1187  +      return SQLITE_OK;
         1188  +    }
  1186   1189     }
  1187         -  return SQLITE_ERROR;
         1190  +  return SQLITE_NOTFOUND;
  1188   1191   }
  1189   1192   
  1190   1193   /*
  1191   1194   ** Return the sector size in bytes of the underlying block device for
  1192   1195   ** the specified file. This is almost always 512 bytes, but may be
  1193   1196   ** larger for some devices.
  1194   1197   **

Changes to src/sqlite.h.in.

   381    381   #define SQLITE_BUSY         5   /* The database file is locked */
   382    382   #define SQLITE_LOCKED       6   /* A table in the database is locked */
   383    383   #define SQLITE_NOMEM        7   /* A malloc() failed */
   384    384   #define SQLITE_READONLY     8   /* Attempt to write a readonly database */
   385    385   #define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
   386    386   #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
   387    387   #define SQLITE_CORRUPT     11   /* The database disk image is malformed */
   388         -#define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
          388  +#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */
   389    389   #define SQLITE_FULL        13   /* Insertion failed because database is full */
   390    390   #define SQLITE_CANTOPEN    14   /* Unable to open the database file */
   391    391   #define SQLITE_PROTOCOL    15   /* Database lock protocol error */
   392    392   #define SQLITE_EMPTY       16   /* Database is empty */
   393    393   #define SQLITE_SCHEMA      17   /* The database schema changed */
   394    394   #define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
   395    395   #define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
................................................................................
   613    613   ** write return values.  Potential uses for xFileControl() might be
   614    614   ** functions to enable blocking locks with timeouts, to change the
   615    615   ** locking strategy (for example to use dot-file locks), to inquire
   616    616   ** about the status of a lock, or to break stale locks.  The SQLite
   617    617   ** core reserves all opcodes less than 100 for its own use.
   618    618   ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
   619    619   ** Applications that define a custom xFileControl method should use opcodes
   620         -** greater than 100 to avoid conflicts.
          620  +** greater than 100 to avoid conflicts.  VFS implementations should
          621  +** return [SQLITE_NOTFOUND] for file control opcodes that they do not
          622  +** recognize.
   621    623   **
   622    624   ** The xSectorSize() method returns the sector size of the
   623    625   ** device that underlies the file.  The sector size is the
   624    626   ** minimum write that can be performed without disturbing
   625    627   ** other bytes in the file.  The xDeviceCharacteristics()
   626    628   ** method returns a bit vector describing behaviors of the
   627    629   ** underlying device:

Changes to src/test1.c.

  4797   4797     if( objc!=2 ){
  4798   4798       Tcl_AppendResult(interp, "wrong # args: should be \"",
  4799   4799           Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
  4800   4800       return TCL_ERROR;
  4801   4801     }
  4802   4802     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  4803   4803     rc = sqlite3_file_control(db, 0, 0, &iArg);
  4804         -  assert( rc==SQLITE_ERROR );
         4804  +  assert( rc==SQLITE_NOTFOUND );
  4805   4805     rc = sqlite3_file_control(db, "notadatabase", SQLITE_FCNTL_LOCKSTATE, &iArg);
  4806   4806     assert( rc==SQLITE_ERROR );
  4807   4807     rc = sqlite3_file_control(db, "main", -1, &iArg);
  4808         -  assert( rc==SQLITE_ERROR );
         4808  +  assert( rc==SQLITE_NOTFOUND );
  4809   4809     rc = sqlite3_file_control(db, "temp", -1, &iArg);
  4810         -  assert( rc==SQLITE_ERROR );
         4810  +  assert( rc==SQLITE_NOTFOUND || rc==SQLITE_ERROR );
  4811   4811   
  4812   4812     return TCL_OK;
  4813   4813   }
  4814   4814   
  4815   4815   
  4816   4816   /*
  4817   4817   ** tclcmd:   file_control_lasterrno_test DB