Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: third_party/sqlite/sqlite-src-3080704/ext/misc/wholenumber.c

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3080704/ext/misc/wholenumber.c
diff --git a/third_party/sqlite/src/src/test_wholenumber.c b/third_party/sqlite/sqlite-src-3080704/ext/misc/wholenumber.c
similarity index 82%
copy from third_party/sqlite/src/src/test_wholenumber.c
copy to third_party/sqlite/sqlite-src-3080704/ext/misc/wholenumber.c
index 150dc95ac49ee64d859950df0cbc229644a57a87..63369c6ac474e1cae1b4309f78536166ebc716a5 100644
--- a/third_party/sqlite/src/src/test_wholenumber.c
+++ b/third_party/sqlite/sqlite-src-3080704/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 <assert.h>
#include <string.h>
@@ -33,8 +34,8 @@
typedef struct wholenumber_cursor wholenumber_cursor;
struct wholenumber_cursor {
sqlite3_vtab_cursor base; /* Base class - must be first */
- unsigned iValue; /* Current value */
- unsigned mxValue; /* Maximum value */
+ sqlite3_int64 iValue; /* Current value */
+ sqlite3_int64 mxValue; /* Maximum value */
};
/* Methods for the wholenumber module */
@@ -217,7 +218,13 @@ static int wholenumberBestIndex(
){
pIdxInfo->orderByConsumed = 1;
}
- pIdxInfo->estimatedCost = (double)1;
+ if( (idxNum & 12)==0 ){
+ pIdxInfo->estimatedCost = (double)100000000;
+ }else if( (idxNum & 3)==0 ){
+ pIdxInfo->estimatedCost = (double)5;
+ }else{
+ pIdxInfo->estimatedCost = (double)1;
+ }
return SQLITE_OK;
}
@@ -250,62 +257,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 <tcl.h>
-/*
-** 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<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
- Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
- aObjCmd[i].xProc, aObjCmd[i].clientData, 0);
- }
- return TCL_OK;
-}
-
-#endif /* SQLITE_TEST */
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/ext/misc/vtshim.c ('k') | third_party/sqlite/sqlite-src-3080704/ext/rtree/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698