From: drh Date: Thu, 25 Apr 2013 11:58:36 +0000 (+0000) Subject: Make test_wholenumber.c into a loadable extension and move it to X-Git-Tag: version-3.7.17~55^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24b6422dcb66ec9ad8828b2a65e6e5afc224be22;p=thirdparty%2Fsqlite.git Make test_wholenumber.c into a loadable extension and move it to ext/misc/wholenumber.c. FossilOrigin-Name: efcc9dd012b5f193324dfc2ee9c2410c16fc1b3b --- diff --git a/src/test_wholenumber.c b/ext/misc/wholenumber.c similarity index 83% rename from src/test_wholenumber.c rename to ext/misc/wholenumber.c index 7c42d01691..a6d79507c4 100644 --- a/src/test_wholenumber.c +++ b/ext/misc/wholenumber.c @@ -22,7 +22,8 @@ ** ** 1 2 3 4 5 6 7 8 9 */ -#include "sqlite3.h" +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT1 #include #include @@ -250,62 +251,18 @@ static sqlite3_module wholenumberModule = { #endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/* -** Register the wholenumber virtual table -*/ -int wholenumber_register(sqlite3 *db){ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_wholenumber_init( + sqlite3 *db, + char **pzErrMsg, + const sqlite3_api_routines *pApi +){ int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); #ifndef SQLITE_OMIT_VIRTUALTABLE rc = sqlite3_create_module(db, "wholenumber", &wholenumberModule, 0); #endif return rc; } - -#ifdef SQLITE_TEST -#include -/* -** Decode a pointer to an sqlite3 object. -*/ -extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); - -/* -** Register the echo virtual table module. -*/ -static int register_wholenumber_module( - ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ - Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ - int objc, /* Number of arguments */ - Tcl_Obj *CONST objv[] /* Command arguments */ -){ - sqlite3 *db; - if( objc!=2 ){ - Tcl_WrongNumArgs(interp, 1, objv, "DB"); - return TCL_ERROR; - } - if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; - wholenumber_register(db); - return TCL_OK; -} - - -/* -** Register commands with the TCL interpreter. -*/ -int Sqlitetestwholenumber_Init(Tcl_Interp *interp){ - static struct { - char *zName; - Tcl_ObjCmdProc *xProc; - void *clientData; - } aObjCmd[] = { - { "register_wholenumber_module", register_wholenumber_module, 0 }, - }; - int i; - for(i=0; i