Skip to content

Commit

Permalink
Fix the "sqlite3" command in the TCL interface so that it correctly r…
Browse files Browse the repository at this point in the history
…eturns

an error if invoked with no arguments.
  • Loading branch information
D. Richard Hipp committed Sep 19, 2018
1 parent 89bd215 commit c6ecdc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tclsqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -3497,6 +3497,7 @@ static int SQLITE_TCLAPI DbMain(
flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX;
#endif

if( objc==1 ) return sqliteCmdUsage(interp, objv);
if( objc==2 ){
zArg = Tcl_GetStringFromObj(objv[1], 0);
if( strcmp(zArg,"-version")==0 ){
Expand Down
7 changes: 7 additions & 0 deletions test/tclsqlite.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#
# $Id: tclsqlite.test,v 1.73 2009/03/16 13:19:36 danielk1977 Exp $

catch {sqlite3}

set testdir [file dirname $argv0]
source $testdir/tester.tcl

Expand All @@ -31,6 +33,11 @@ do_test tcl-1.1 {
regsub {really_sqlite3} $msg {sqlite3} msg
lappend v $msg
} [list 1 "wrong # args: should be \"$r\""]
do_test tcl-1.1.1 {
set v [catch {sqlite3} msg]
regsub {really_sqlite3} $msg {sqlite3} msg
lappend v $msg
} [list 1 "wrong # args: should be \"$r\""]
do_test tcl-1.2 {
set v [catch {db bogus} msg]
lappend v $msg
Expand Down

0 comments on commit c6ecdc6

Please sign in to comment.