/ Check-in [d0e3d466]
Login

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

Overview
Comment:Bug fix in the new "exists" method of the TCL interface. (CVS 2857)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d0e3d466094f7b2f74ed7ebb324e5024ea8faa6f
User & Date: drh 2006-01-04 18:13:26
Context
2006-01-04
21:40
Bug fix in the IF NOT EXISTS logic. (CVS 2858) check-in: cb9095ac user: drh tags: trunk
18:13
Bug fix in the new "exists" method of the TCL interface. (CVS 2857) check-in: d0e3d466 user: drh tags: trunk
15:58
Update document for CREATE INDEX IF NOT EXISTS and DROP INDEX IF EXISTS (CVS 2856) check-in: 963ba8b8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/tclsqlite.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** A TCL Interface to SQLite
    13     13   **
    14         -** $Id: tclsqlite.c,v 1.143 2006/01/03 00:33:50 drh Exp $
           14  +** $Id: tclsqlite.c,v 1.144 2006/01/04 18:13:26 drh Exp $
    15     15   */
    16     16   #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
    17     17   
    18     18   #include "sqliteInt.h"
    19     19   #include "hash.h"
    20     20   #include "tcl.h"
    21     21   #include <stdlib.h>
................................................................................
  1203   1203         pRet = Tcl_NewObj();
  1204   1204         Tcl_IncrRefCount(pRet);
  1205   1205       }else{
  1206   1206         if( objc!=3 ){
  1207   1207           Tcl_WrongNumArgs(interp, 2, objv, "SQL");
  1208   1208           return TCL_ERROR;
  1209   1209         }
  1210         -      pRet = 0;
  1211   1210         if( choice==DB_EXISTS ){
  1212         -        Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0));
         1211  +        pRet = Tcl_NewBooleanObj(0);
         1212  +        Tcl_IncrRefCount(pRet);
         1213  +      }else{
         1214  +        pRet = 0;
  1213   1215         }
  1214   1216       }
  1215   1217       if( objc==3 ){
  1216   1218         pArray = pScript = 0;
  1217   1219       }else if( objc==4 ){
  1218   1220         pArray = 0;
  1219   1221         pScript = objv[3];
................................................................................
  1419   1421               if( pRet==0 ){
  1420   1422                 pRet = pVal;
  1421   1423                 Tcl_IncrRefCount(pRet);
  1422   1424               }
  1423   1425               rc = TCL_BREAK;
  1424   1426               i = nCol;
  1425   1427             }else if( choice==DB_EXISTS ){
  1426         -            assert( pRet==0 );
  1427         -            Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
         1428  +            Tcl_DecrRefCount(pRet);
         1429  +            pRet = Tcl_NewBooleanObj(1);
         1430  +            Tcl_IncrRefCount(pRet);
  1428   1431               rc = TCL_BREAK;
  1429   1432               i = nCol;
  1430   1433             }else{
  1431   1434               Tcl_ListObjAppendElement(interp, pRet, pVal);
  1432   1435             }
  1433   1436           }
  1434   1437