Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Allow the output arguments in sqlite_compile and sqlite_step to be NULL pointers. Tickets #384 and #385. (CVS 1049) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dd84f88f6c4012e4a093a4881f6fe505 |
User & Date: | drh 2003-07-09 00:28:14.000 |
Context
2003-07-09
| ||
16:34 | An an extra test associated with ticket #387. (CVS 1050) (check-in: 6a07ac3782 user: drh tags: trunk) | |
00:28 | Allow the output arguments in sqlite_compile and sqlite_step to be NULL pointers. Tickets #384 and #385. (CVS 1049) (check-in: dd84f88f6c user: drh tags: trunk) | |
2003-07-08
| ||
23:42 | Enhance the C/C++ documentation to clarify the meaning of the return value from sqlite_changes(). Ticket #383. (CVS 1048) (check-in: 303b2da1ac user: drh tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.138 2003/07/09 00:28:14 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
641 642 643 644 645 646 647 | sqliteStrRealloc(pzErrMsg); if( sParse.rc==SQLITE_SCHEMA ){ sqliteResetInternalSchema(db, 0); } if( sParse.useCallback==0 ){ assert( ppVm ); *ppVm = (sqlite_vm*)sParse.pVdbe; | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | sqliteStrRealloc(pzErrMsg); if( sParse.rc==SQLITE_SCHEMA ){ sqliteResetInternalSchema(db, 0); } if( sParse.useCallback==0 ){ assert( ppVm ); *ppVm = (sqlite_vm*)sParse.pVdbe; if( pzTail ) *pzTail = sParse.zTail; } if( sqliteSafetyOff(db) ) goto exec_misuse; return sParse.rc; exec_misuse: if( pzErrMsg ){ *pzErrMsg = 0; |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.26 2003/07/09 00:28:15 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include "os.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
639 640 641 642 643 644 645 | Tcl_AppendResult(interp, sqlite_error_string(rc), 0); return TCL_ERROR; } return TCL_OK; } /* | | | | | | | | > | | > > | | | | | | | > > | | | | | > | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | Tcl_AppendResult(interp, sqlite_error_string(rc), 0); return TCL_ERROR; } return TCL_OK; } /* ** Usage: sqlite_compile DB SQL ?TAILVAR? ** ** Attempt to compile an SQL statement. Return a pointer to the virtual ** machine used to execute that statement. Unprocessed SQL is written ** into TAILVAR. */ static int test_compile( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite *db; sqlite_vm *vm; int rc; char *zErr = 0; const char *zTail; char zBuf[50]; if( argc!=3 && argc!=4 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB SQL TAILVAR", 0); return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; rc = sqlite_compile(db, argv[2], argc==4 ? &zTail : 0, &vm, &zErr); if( argc==4 ) Tcl_SetVar(interp, argv[3], zTail, 0); if( rc ){ assert( vm==0 ); sprintf(zBuf, "(%d) ", rc); Tcl_AppendResult(interp, zBuf, zErr, 0); sqlite_freemem(zErr); return TCL_ERROR; } if( vm ){ if( makePointerStr(interp, zBuf, vm) ) return TCL_ERROR; Tcl_AppendResult(interp, zBuf, 0); } return TCL_OK; } /* ** Usage: sqlite_step VM ?NVAR? ?VALUEVAR? ?COLNAMEVAR? ** ** Step a virtual machine. Return a the result code as a string. ** Column results are written into three variables. */ static int test_step( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite_vm *vm; int rc, i; const char **azValue = 0; const char **azColName = 0; int N = 0; char *zRc; char zBuf[50]; if( argc<2 || argc>5 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " VM NVAR VALUEVAR COLNAMEVAR", 0); return TCL_ERROR; } if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR; rc = sqlite_step(vm, argc>=3?&N:0, argc>=4?&azValue:0, argc==5?&azColName:0); if( argc>=3 ){ sprintf(zBuf, "%d", N); Tcl_SetVar(interp, argv[2], zBuf, 0); } if( argc>=4 ){ Tcl_SetVar(interp, argv[3], "", 0); if( azValue ){ for(i=0; i<N; i++){ Tcl_SetVar(interp, argv[3], azValue[i] ? azValue[i] : "", TCL_APPEND_VALUE | TCL_LIST_ELEMENT); } } } if( argc==5 ){ Tcl_SetVar(interp, argv[4], "", 0); if( azColName ){ for(i=0; i<N*2; i++){ Tcl_SetVar(interp, argv[4], azColName[i] ? azColName[i] : "", TCL_APPEND_VALUE | TCL_LIST_ELEMENT); } } } switch( rc ){ case SQLITE_DONE: zRc = "SQLITE_DONE"; break; case SQLITE_BUSY: zRc = "SQLITE_BUSY"; break; case SQLITE_ROW: zRc = "SQLITE_ROW"; break; case SQLITE_ERROR: zRc = "SQLITE_ERROR"; break; |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.233 2003/07/09 00:28:15 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** The makefile scans this source file and creates the following |
︙ | ︙ | |||
806 807 808 809 810 811 812 | } if( p->explain ){ rc = sqliteVdbeList(p); }else{ rc = sqliteVdbeExec(p); } if( rc==SQLITE_DONE || rc==SQLITE_ROW ){ | | | < | > > | | | | > | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | } if( p->explain ){ rc = sqliteVdbeList(p); }else{ rc = sqliteVdbeExec(p); } if( rc==SQLITE_DONE || rc==SQLITE_ROW ){ if( pazColName ) *pazColName = (const char**)p->azColName; if( pN ) *pN = p->nResColumn; }else{ if( pazColName) *pazColName = 0; if( pN ) *pN = 0; } if( pazValue ){ if( rc==SQLITE_ROW ){ *pazValue = (const char**)p->azResColumn; }else{ *pazValue = 0; } } if( sqliteSafetyOff(db) ){ return SQLITE_MISUSE; } return rc; } |
︙ | ︙ |
Changes to test/capi2.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2003 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2003 January 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # # $Id: capi2.test,v 1.9 2003/07/09 00:28:15 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Check basic functionality # |
︙ | ︙ | |||
457 458 459 460 461 462 463 464 465 466 467 | # Ticket #261 - make sure we can finalize before the end of a query. # do_test capi2-8.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2} TAIL] sqlite_finalize $VM1 } {} db2 close finish_test | > > > > > > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | # Ticket #261 - make sure we can finalize before the end of a query. # do_test capi2-8.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2} TAIL] sqlite_finalize $VM1 } {} # Tickets #384 and #385 - make sure the TAIL argument to sqlite_compile # and all of the return pointers in sqlite_step can be null. # do_test capi2-9.1 { set VM1 [sqlite_compile $DB {SELECT * FROM t2}] sqlite_step $VM1 sqlite_finalize $VM1 } {} db2 close finish_test |