1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Fix the shells so that they always enable the codec if it is available,

even if no key is supplied. (CVS 1226)

FossilOrigin-Name: 95989717e17d52b2306374f5cf7613c3bd4e7801
This commit is contained in:
drh
2004-02-11 10:37:23 +00:00
parent 7e26d75094
commit eb8ed70db5
4 changed files with 17 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
C Fix\san\suninitialized\svariable\sin\sexpr.c.\s\sTicket\s#604.\s(CVS\s1225) C Fix\sthe\sshells\sso\sthat\sthey\salways\senable\sthe\scodec\sif\sit\sis\savailable,\neven\sif\sno\skey\sis\ssupplied.\s(CVS\s1226)
D 2004-02-11T10:35:30 D 2004-02-11T10:37:23
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -47,11 +47,11 @@ F src/pragma.c 89d62c31c6f0a43376fe8d20549b87a6d30c467a
F src/printf.c 84e4ea4ba49cbbf930e95e82295127ad5843ae1f F src/printf.c 84e4ea4ba49cbbf930e95e82295127ad5843ae1f
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2 F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
F src/select.c a0211d1a6a94f6c3e611096e77f2d689a641495e F src/select.c a0211d1a6a94f6c3e611096e77f2d689a641495e
F src/shell.c 514056d54893e58995ab27237e54c7f057e47597 F src/shell.c c1c7242ede2af46044378d36d2c533e98fd59fb8
F src/sqlite.h.in 1798588cab21ebf9fac3aad7fc1539b396c1f91d F src/sqlite.h.in 1798588cab21ebf9fac3aad7fc1539b396c1f91d
F src/sqliteInt.h f03de87717569619884830b1833eca2b257fc675 F src/sqliteInt.h f03de87717569619884830b1833eca2b257fc675
F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895 F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
F src/tclsqlite.c 735da4580554cd38fc9360fe7d36ceff9574a84e F src/tclsqlite.c c4174ecb406810435b6670f6e470e39424c52804
F src/test1.c 56e9a156df3ad5e4e98df776776e963effc727f7 F src/test1.c 56e9a156df3ad5e4e98df776776e963effc727f7
F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996 F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5 F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
@@ -183,7 +183,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P f2bdccf4bb2f796aafb64c33e55f62a1794d750c P 1673bf7c7b64542530ee03328186be33cb88c98d
R 4c4a094fa84cb46b0571c51095cf3799 R cf11e1504e84208ddac23675d6789b35
U drh U drh
Z 3418a85212310c666c6e9252c10a191a Z a96d40097a3b13bb21b3a609a39afb50

View File

@@ -1 +1 @@
1673bf7c7b64542530ee03328186be33cb88c98d 95989717e17d52b2306374f5cf7613c3bd4e7801

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line ** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases. ** utility for accessing SQLite databases.
** **
** $Id: shell.c,v 1.86 2004/02/11 02:18:07 drh Exp $ ** $Id: shell.c,v 1.87 2004/02/11 10:37:23 drh Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -512,12 +512,11 @@ static void open_db(struct callback_data *p){
if( p->db==0 ){ if( p->db==0 ){
char *zErrMsg = 0; char *zErrMsg = 0;
#ifdef SQLITE_HAS_CODEC #ifdef SQLITE_HAS_CODEC
if( p->zKey && p->zKey[0] ){ int n = p->zKey ? strlen(p->zKey) : 0;
int n = strlen(p->zKey); p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, &zErrMsg);
p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, &zErrMsg); #else
}else
#endif
p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg); p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg);
#endif
if( p->db==0 ){ if( p->db==0 ){
if( zErrMsg ){ if( zErrMsg ){
fprintf(stderr,"Unable to open database \"%s\": %s\n", fprintf(stderr,"Unable to open database \"%s\": %s\n",

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** A TCL Interface to SQLite ** A TCL Interface to SQLite
** **
** $Id: tclsqlite.c,v 1.56 2004/02/11 02:18:07 drh Exp $ ** $Id: tclsqlite.c,v 1.57 2004/02/11 10:37:23 drh Exp $
*/ */
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@@ -1064,11 +1064,10 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
zFile = Tcl_GetStringFromObj(objv[2], 0); zFile = Tcl_GetStringFromObj(objv[2], 0);
#ifdef SQLITE_HAS_CODEC #ifdef SQLITE_HAS_CODEC
if( nKey>0 ){ p->db = sqlite_open_encrypted(zFile, pKey, nKey, &zErrMsg);
p->db = sqlite_open_encrypted(zFile, pKey, nKey, &zErrMsg); #else
}else
#endif
p->db = sqlite_open(zFile, mode, &zErrMsg); p->db = sqlite_open(zFile, mode, &zErrMsg);
#endif
if( p->db==0 ){ if( p->db==0 ){
Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
Tcl_Free((char*)p); Tcl_Free((char*)p);