/ Check-in [e0ce3fc0]
Login

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

Overview
Comment:When compiling with SQLITE_HAS_CODEC, honor the hexkey= query parameter on URI pathnames in sqlite3_open_v2().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e0ce3fc089c2523b8b718b4a4f9ab8c4d0432fc7
User & Date: drh 2015-10-26 14:41:35
Context
2015-10-26
14:54
Fix a C99-ism and a harmless compiler warning. check-in: 138783b5 user: drh tags: trunk
14:41
When compiling with SQLITE_HAS_CODEC, honor the hexkey= query parameter on URI pathnames in sqlite3_open_v2(). check-in: e0ce3fc0 user: drh tags: trunk
12:55
Remove an unreachable branch in malloc.c. check-in: a36b7fe9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  2949   2949     }
  2950   2950     *ppDb = db;
  2951   2951   #ifdef SQLITE_ENABLE_SQLLOG
  2952   2952     if( sqlite3GlobalConfig.xSqllog ){
  2953   2953       /* Opening a db handle. Fourth parameter is passed 0. */
  2954   2954       void *pArg = sqlite3GlobalConfig.pSqllogArg;
  2955   2955       sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
         2956  +  }
         2957  +#endif
         2958  +#if defined(SQLITE_HAS_CODEC)
         2959  +  if( rc==SQLITE_OK ){
         2960  +    const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
         2961  +    if( zHexKey && zHexKey[0] ){
         2962  +      u8 iByte;
         2963  +      int i;
         2964  +      char zKey[40];
         2965  +      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
         2966  +        iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
         2967  +        if( (i&1)!=0 ) zKey[i/2] = iByte;
         2968  +      }
         2969  +      sqlite3_key_v2(db, 0, zKey, i/2);
         2970  +    }
  2956   2971     }
  2957   2972   #endif
  2958   2973     return rc & 0xff;
  2959   2974   }
  2960   2975   
  2961   2976   /*
  2962   2977   ** Open a new database handle.