mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Allow the output arguments in sqlite_compile and sqlite_step to be NULL
pointers. Tickets #384 and #385. (CVS 1049) FossilOrigin-Name: dd84f88f6c4012e4a093a4881f6fe50527bb2006
This commit is contained in:
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Enhance\sthe\sC/C++\sdocumentation\sto\sclarify\sthe\smeaning\sof\sthe\sreturn\svalue\nfrom\ssqlite_changes().\s\sTicket\s#383.\s(CVS\s1048)
|
||||
D 2003-07-08T23:42:25
|
||||
C Allow\sthe\soutput\sarguments\sin\ssqlite_compile\sand\ssqlite_step\sto\sbe\sNULL\npointers.\s\sTickets\s#384\sand\s#385.\s(CVS\s1049)
|
||||
D 2003-07-09T00:28:14
|
||||
F Makefile.in 9ad23ed4ca97f9670c4496432e3fbd4b3760ebde
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -33,7 +33,7 @@ F src/func.c 6b23578d48a8be98a664db145a635c2fa9ddb57b
|
||||
F src/hash.c 058f077c1f36f266581aa16f907a3903abf64aa3
|
||||
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
||||
F src/insert.c fc4c26a0bb505fb802babfb9a7b7a1d4be2e3061
|
||||
F src/main.c 1bfd1bfed2d8d242579ec9bd0425a9e8e3bef64d
|
||||
F src/main.c 8053b3a76e4e77c769b324a2f1cc99a0265d0ec4
|
||||
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
||||
F src/os.c 0d5252d60c1b0f21a343b18248d3dfcafb94e621
|
||||
F src/os.h 9e5bbddff123187295e3d00d49af06192cd1cd49
|
||||
@ -50,7 +50,7 @@ F src/sqlite.h.in 54619fa5df4c83b22def66bb3d24808fd03dcbae
|
||||
F src/sqliteInt.h fed31c3e6d21b7a8a38048f8f8a07599360f8946
|
||||
F src/table.c 4301926464d88d2c2c7cd21c3360aa75bf068b95
|
||||
F src/tclsqlite.c d6860dcd56348b9521726280b72c412d2a33ae97
|
||||
F src/test1.c b9cfee0bd97d0ade63a3ce76e910b444fb32dce2
|
||||
F src/test1.c b12b585bfb4763df3262975ed8d3f4f274b5eaed
|
||||
F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700
|
||||
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
|
||||
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
|
||||
@ -59,7 +59,7 @@ F src/trigger.c 6ff205aaac4869e402d9902e528e1d22a85de14c
|
||||
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
|
||||
F src/util.c 566c7780170dd11fb1ad5de3ba81f0dfea7cccf0
|
||||
F src/vacuum.c 0820984615786c9ccdaad8032a792309b354a8eb
|
||||
F src/vdbe.c 3779009cc7658d61b11d1980d6efc8af1ab0f7a1
|
||||
F src/vdbe.c 7bef599539f72d5b5ae62723a7d52aefe9bfb2f0
|
||||
F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
|
||||
F src/where.c 6834140938558f6ca8ee5e6decd7b6a74d65af1f
|
||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||
@ -74,7 +74,7 @@ F test/btree3.test e597fb59be2ac0ea69c62aaa2064e998e528b665
|
||||
F test/btree3rb.test 127efcf5cdfcc352054e7db12622b01cdd8b36ac
|
||||
F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
|
||||
F test/btree4rb.test ae6f0438512edcb45cf483471cd6070a765963a9
|
||||
F test/capi2.test 3663b62fe3db2adf2cbfe7d0ce5934c78aad5bd9
|
||||
F test/capi2.test 9634deaa27449e684f4b69ea2ccd8a77ee130bb8
|
||||
F test/conflict.test 0a66a573b8b4f8b781b2ebb7d4f27dcfd9e87312
|
||||
F test/copy.test c860847f1bd66175ef7cb724326a1700e0295820
|
||||
F test/delete.test 92256384f1801760180ded129f7427884cf28886
|
||||
@ -168,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
|
||||
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
P a49ee69e98df80b479aa6bb97a9af9c6abf04e3f
|
||||
R df294d7db0117d537360e6dfc3d8b829
|
||||
P 303b2da1acd4b7b9d89dec0653e5f88fc10d56b8
|
||||
R 34f9b1eab35573ed8198daefaef46c95
|
||||
U drh
|
||||
Z abfd41d53707aa73aacfecb7fb8f6695
|
||||
Z b4400a15dee5249817b63cf50e812fdb
|
||||
|
@ -1 +1 @@
|
||||
303b2da1acd4b7b9d89dec0653e5f88fc10d56b8
|
||||
dd84f88f6c4012e4a093a4881f6fe50527bb2006
|
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.137 2003/06/23 15:15:03 drh Exp $
|
||||
** $Id: main.c,v 1.138 2003/07/09 00:28:14 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -645,7 +645,7 @@ static int sqliteMain(
|
||||
if( sParse.useCallback==0 ){
|
||||
assert( ppVm );
|
||||
*ppVm = (sqlite_vm*)sParse.pVdbe;
|
||||
*pzTail = sParse.zTail;
|
||||
if( pzTail ) *pzTail = sParse.zTail;
|
||||
}
|
||||
if( sqliteSafetyOff(db) ) goto exec_misuse;
|
||||
return sParse.rc;
|
||||
|
46
src/test1.c
46
src/test1.c
@ -13,7 +13,7 @@
|
||||
** is not included in the SQLite library. It is used for automated
|
||||
** testing of the SQLite library.
|
||||
**
|
||||
** $Id: test1.c,v 1.25 2003/06/16 03:08:19 drh Exp $
|
||||
** $Id: test1.c,v 1.26 2003/07/09 00:28:15 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@ -643,7 +643,7 @@ static int sqlite_datatypes(
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: sqlite_compile DB SQL TAILVAR
|
||||
** 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
|
||||
@ -661,14 +661,14 @@ static int test_compile(
|
||||
char *zErr = 0;
|
||||
const char *zTail;
|
||||
char zBuf[50];
|
||||
if( argc!=4 ){
|
||||
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], &zTail, &vm, &zErr);
|
||||
Tcl_SetVar(interp, argv[3], zTail, 0);
|
||||
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);
|
||||
@ -684,7 +684,7 @@ static int test_compile(
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: sqlite_step VM NVAR VALUEVAR COLNAMEVAR
|
||||
** 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.
|
||||
@ -702,27 +702,33 @@ static int test_step(
|
||||
int N = 0;
|
||||
char *zRc;
|
||||
char zBuf[50];
|
||||
if( argc!=5 ){
|
||||
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, &N, &azValue, &azColName);
|
||||
sprintf(zBuf, "%d", N);
|
||||
Tcl_SetVar(interp, argv[2], zBuf, 0);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
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 ){
|
||||
|
20
src/vdbe.c
20
src/vdbe.c
@ -36,7 +36,7 @@
|
||||
** 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.232 2003/07/06 17:22:25 drh Exp $
|
||||
** $Id: vdbe.c,v 1.233 2003/07/09 00:28:15 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -810,16 +810,18 @@ int sqlite_step(
|
||||
rc = sqliteVdbeExec(p);
|
||||
}
|
||||
if( rc==SQLITE_DONE || rc==SQLITE_ROW ){
|
||||
*pazColName = (const char**)p->azColName;
|
||||
*pN = p->nResColumn;
|
||||
if( pazColName ) *pazColName = (const char**)p->azColName;
|
||||
if( pN ) *pN = p->nResColumn;
|
||||
}else{
|
||||
*pN = 0;
|
||||
*pazColName = 0;
|
||||
if( pazColName) *pazColName = 0;
|
||||
if( pN ) *pN = 0;
|
||||
}
|
||||
if( rc==SQLITE_ROW ){
|
||||
*pazValue = (const char**)p->azResColumn;
|
||||
}else{
|
||||
*pazValue = 0;
|
||||
if( pazValue ){
|
||||
if( rc==SQLITE_ROW ){
|
||||
*pazValue = (const char**)p->azResColumn;
|
||||
}else{
|
||||
*pazValue = 0;
|
||||
}
|
||||
}
|
||||
if( sqliteSafetyOff(db) ){
|
||||
return SQLITE_MISUSE;
|
||||
|
@ -11,7 +11,7 @@
|
||||
# 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.8 2003/06/28 16:20:24 drh Exp $
|
||||
# $Id: capi2.test,v 1.9 2003/07/09 00:28:15 drh Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -461,6 +461,14 @@ do_test capi2-8.1 {
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user