1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add a module-destructor to the echo module (test8.c) to improve code coverage. (CVS 4372)

FossilOrigin-Name: e3dd3651421ee723f9b7550fc333a308a83b276d
This commit is contained in:
danielk1977
2007-09-03 11:51:50 +00:00
parent fa18bece7a
commit 860b6cd2b9
3 changed files with 24 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
C Handle\stransient\smalloc()\sfailures\sin\ssqlite3CreateFunc().\s(CVS\s4371)
D 2007-09-03T11:04:22
C Add\sa\smodule-destructor\sto\sthe\secho\smodule\s(test8.c)\sto\simprove\scode\scoverage.\s(CVS\s4372)
D 2007-09-03T11:51:50
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -143,7 +143,7 @@ F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
F src/test6.c 0513982dfef4da2a4154b538d2bf538b84ca21d3
F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
F src/test8.c 146cb2c2e7e9bac0e30e4890e7880ffe3e223a68
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
F src/test_async.c 8b6aa6a5701bf3cf52708db178379ee608b44b0c
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
@@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P ed2a2e0102c4fd2221096028d55a6f1d54f97274
R a8071f6051ea0c2f23cdc36ae305ef4b
P c0ce63196458c81e0859fc8a38f2dd2145a580bc
R e4b27aa117d92ab923ab170f9a80b4a8
U danielk1977
Z fb15b228bac149e738b86ec4993bbe7d
Z 8ba1b1c43d2e7301aebcb9fd4022cc57

View File

@@ -1 +1 @@
c0ce63196458c81e0859fc8a38f2dd2145a580bc
e3dd3651421ee723f9b7550fc333a308a83b276d

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test8.c,v 1.55 2007/08/29 12:31:28 danielk1977 Exp $
** $Id: test8.c,v 1.56 2007/09/03 11:51:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -349,6 +349,11 @@ static int echoDestructor(sqlite3_vtab *pVtab){
return 0;
}
typedef struct EchoModule EchoModule;
struct EchoModule {
Tcl_Interp *interp;
};
/*
** This function is called to do the work of the xConnect() method -
** to allocate the required in-memory structures for a newly connected
@@ -370,7 +375,7 @@ static int echoConstructor(
if( !pVtab ){
return SQLITE_NOMEM;
}
pVtab->interp = (Tcl_Interp *)pAux;
pVtab->interp = ((EchoModule *)pAux)->interp;
pVtab->db = db;
/* Allocate echo_vtab.zThis */
@@ -427,7 +432,7 @@ static int echoCreate(
char **pzErr
){
int rc = SQLITE_OK;
appendToEchoModule((Tcl_Interp *)(pAux), "xCreate");
appendToEchoModule(((EchoModule *)pAux)->interp, "xCreate");
rc = echoConstructor(db, pAux, argc, argv, ppVtab, pzErr);
/* If there were two arguments passed to the module at the SQL level
@@ -462,7 +467,7 @@ static int echoConnect(
sqlite3_vtab **ppVtab,
char **pzErr
){
appendToEchoModule((Tcl_Interp *)(pAux), "xConnect");
appendToEchoModule(((EchoModule *)pAux)->interp, "xConnect");
return echoConstructor(db, pAux, argc, argv, ppVtab, pzErr);
}
@@ -1125,6 +1130,10 @@ static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){
return TCL_OK;
}
static void moduleDestroy(void *p){
sqlite3_free(p);
}
/*
** Register the echo virtual table module.
*/
@@ -1135,12 +1144,15 @@ static int register_echo_module(
Tcl_Obj *CONST objv[] /* Command arguments */
){
sqlite3 *db;
EchoModule *pMod;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "DB");
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
sqlite3_create_module(db, "echo", &echoModule, (void *)interp);
pMod = sqlite3_malloc(sizeof(EchoModule));
pMod->interp = interp;
sqlite3_create_module_v2(db, "echo", &echoModule, (void*)pMod, moduleDestroy);
return TCL_OK;
}