/ Check-in [31a51b4d]
Login

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

Overview
Comment:Always enable URI filenames when compiling with SQLITE_HAS_CODEC. Also allow plaintext keys using the key= query parameter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 31a51b4d168065fa59cc0e52ba798bd87ac82160c675bd531442b65133edb401
User & Date: drh 2017-05-03 15:54:53
Context
2017-05-03
17:44
Fix the sqlite3GetInt32() function so that it correctly returns 0 on a zero-length input string. check-in: 05eba9e3 user: drh tags: trunk
15:54
Always enable URI filenames when compiling with SQLITE_HAS_CODEC. Also allow plaintext keys using the key= query parameter. check-in: 31a51b4d user: drh tags: trunk
2017-05-02
18:00
Fix the fts3EvalAverageDocsize() routine so that it returns errors from sqlite3_reset() rather than always returning SQLITE_OK. check-in: 430f539c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/global.c.

   133    133   **
   134    134   ** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled
   135    135   ** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
   136    136   **
   137    137   ** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
   138    138   ** disabled. The default value may be changed by compiling with the
   139    139   ** SQLITE_USE_URI symbol defined.
          140  +**
          141  +** URI filenames are enabled by default if SQLITE_HAS_CODEC is
          142  +** enabled.
   140    143   */
   141    144   #ifndef SQLITE_USE_URI
          145  +# ifdef SQLITE_HAS_CODEC
          146  +#  define SQLITE_USE_URI 1
          147  +# else
   142    148   # define  SQLITE_USE_URI 0
   143    149   #endif
          150  +#endif
   144    151   
   145    152   /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
   146    153   ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
   147    154   ** that compile-time option is omitted.
   148    155   */
   149    156   #ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
   150    157   # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1

Changes to src/main.c.

  3091   3091       /* Opening a db handle. Fourth parameter is passed 0. */
  3092   3092       void *pArg = sqlite3GlobalConfig.pSqllogArg;
  3093   3093       sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
  3094   3094     }
  3095   3095   #endif
  3096   3096   #if defined(SQLITE_HAS_CODEC)
  3097   3097     if( rc==SQLITE_OK ){
  3098         -    const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
  3099         -    if( zHexKey && zHexKey[0] ){
         3098  +    const char *zKey;
         3099  +    if( (zKey = sqlite3_uri_parameter(zOpen, "hexkey"))!=0 && zKey[0] ){;
  3100   3100         u8 iByte;
  3101   3101         int i;
  3102         -      char zKey[40];
  3103         -      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
  3104         -        iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
  3105         -        if( (i&1)!=0 ) zKey[i/2] = iByte;
         3102  +      char zDecoded[40];
         3103  +      for(i=0, iByte=0; i<sizeof(zDecoded)*2 && sqlite3Isxdigit(zKey[i]); i++){
         3104  +        iByte = (iByte<<4) + sqlite3HexToInt(zKey[i]);
         3105  +        if( (i&1)!=0 ) zDecoded[i/2] = iByte;
  3106   3106         }
  3107         -      sqlite3_key_v2(db, 0, zKey, i/2);
         3107  +      sqlite3_key_v2(db, 0, zDecoded, i/2);
         3108  +    }else if( (zKey = sqlite3_uri_parameter(zOpen, "key"))!=0 ){
         3109  +      sqlite3_key_v2(db, 0, zKey, sqlite3Strlen30(zKey));
  3108   3110       }
  3109   3111     }
  3110   3112   #endif
  3111   3113     sqlite3_free(zOpen);
  3112   3114     return rc & 0xff;
  3113   3115   }
  3114   3116