/* ** Usage: btree_cursor ID TABLENUM WRITEABLE ** ** Create a new cursor. Return the ID for the cursor. */ static int btree_cursor( object NotUsed, Tcl_Interp interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ TclObject[] argv /* Text of each argument */ ) { Btree pBt; int iTable = 0; BtCursor pCur; int rc = SQLITE_OK; int wrFlag = 0; StringBuilder zBuf = new StringBuilder(30); if (argc != 4) { TCL.Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0].ToString(), " ID TABLENUM WRITEABLE\""); return(TCL.TCL_ERROR); } pBt = (Btree)sqlite3TestTextToPtr(interp, argv[1].ToString()); if (TCL.Tcl_GetInt(interp, argv[2], out iTable)) { return(TCL.TCL_ERROR); } if (TCL.Tcl_GetBoolean(interp, argv[3], out wrFlag)) { return(TCL.TCL_ERROR); } //pCur = (BtCursor )ckalloc(sqlite3BtreeCursorSize()); pCur = new BtCursor();// memset( pCur, 0, sqlite3BtreeCursorSize() ); sqlite3BtreeEnter(pBt); #if !SQLITE_OMIT_SHARED_CACHE rc = sqlite3BtreeLockTable(pBt, iTable, wrFlag); #endif if (rc == SQLITE_OK) { rc = sqlite3BtreeCursor(pBt, iTable, wrFlag, null, pCur); } sqlite3BtreeLeave(pBt); if (rc != 0) { pCur = null;// ckfree( pCur ); TCL.Tcl_AppendResult(interp, errorName(rc), null); ; return(TCL.TCL_ERROR); } sqlite3_snprintf(30, zBuf, "->%p", pCur); if (TCL.Tcl_CreateCommandPointer(interp, zBuf, pCur)) { return(TCL.TCL_ERROR); } else { TCL.Tcl_AppendResult(interp, zBuf); } return(SQLITE_OK); }
/* ** Usage: btree_open FILENAME NCACHE FLAGS ** ** Open a new database */ static int btree_open( object NotUsed, Tcl_Interp interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ TclObject[] argv /* Text of each argument */ ) { Btree pBt = null; int rc; int nCache = 0; int flags = 0; string zBuf = ""; if (argc != 4) { TCL.Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0].ToString(), " FILENAME NCACHE FLAGS\"", ""); return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[2], ref nCache)) { return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[3], ref flags)) { return(TCL.TCL_ERROR); } nRefSqlite3++; if (nRefSqlite3 == 1) { sDb.pVfs = sqlite3_vfs_find(null); sDb.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); sqlite3_mutex_enter(sDb.mutex); } rc = sqlite3BtreeOpen(argv[1].ToString(), sDb, ref pBt, flags, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB); if (rc != SQLITE_OK) { TCL.Tcl_AppendResult(interp, errorName(rc), null); return(TCL.TCL_ERROR); } sqlite3BtreeSetCacheSize(pBt, nCache); sqlite3_snprintf(100, ref zBuf, "->%p", pBt); if (TCL.Tcl_CreateCommandPointer(interp, zBuf, pBt)) { return(TCL.TCL_ERROR); } else { TCL.Tcl_AppendResult(interp, zBuf, null); } return(TCL.TCL_OK); }
/* ** sqlite3BitvecBuiltinTest SIZE PROGRAM ** ** Invoke the SQLITE_TESTCTRL_BITVEC_TEST operator on test_control. ** See comments on sqlite3BitvecBuiltinTest() for additional information. */ static int testBitvecBuiltinTest( object NotUsed, Tcl_Interp interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ TclObject[] argv /* Text of each argument */ ) { int sz = 0, rc; int nProg = 0; int[] aProg = new int[100]; string z; if (argc != 3) { TCL.Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " SIZE PROGRAM\""); } if (TCL.Tcl_GetInt(interp, argv[1], out sz)) { return(TCL.TCL_ERROR); } z = argv[2].ToString() + '\0'; int iz = 0; while (nProg < 99 && z[iz] != 0) { while (z[iz] != 0 && !sqlite3Isdigit(z[iz])) { iz++; } if (z[iz] == 0) { break; } while (sqlite3Isdigit(z[iz])) { aProg[nProg] = aProg[nProg] * 10 + (z[iz] - 48); iz++; } nProg++; } aProg[nProg] = 0; rc = sqlite3_test_control(SQLITE_TESTCTRL_BITVEC_TEST, sz, aProg); TCL.Tcl_SetObjResult(interp, TCL.Tcl_NewIntObj(rc)); return(TCL.TCL_OK); }
/* ** Usage: pager_open FILENAME N-PAGE ** ** Open a new pager */ //static int pager_open( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // u16 pageSize; // Pager *pPager; // Pgno nPage; // int rc; // char zBuf[100]; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " FILENAME N-PAGE\"", 0); // return TCL.TCL_ERROR; // } // if( Tcl_GetInt(interp, argv[2], nPage) ) return TCL.TCL_ERROR; // rc = sqlite3PagerOpen(sqlite3_vfs_find(0), pPager, argv[1], 0, 0, // SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB, // pager_test_reiniter); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // sqlite3PagerSetCachesize(pPager, nPage); // pageSize = test_pagesize; // sqlite3PagerSetPagesize(pPager, pageSize,-1); // sqlite3_snprintf(100, ref zBuf,"%p",pPager); // Tcl_AppendResult(interp, zBuf); // return TCL.TCL_OK; //} /* ** Usage: pager_close ID ** ** Close the given pager. */ //static int pager_close( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerClose(pPager); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_rollback ID ** ** Rollback changes */ //static int pager_rollback( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerRollback(pPager); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_commit ID ** ** Commit all changes */ //static int pager_commit( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerCommitPhaseOne(pPager, 0, 0); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // rc = sqlite3PagerCommitPhaseTwo(pPager); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_stmt_begin ID ** ** Start a new checkpoint. */ //static int pager_stmt_begin( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerOpenSavepoint(pPager, 1); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_stmt_rollback ID ** ** Rollback changes to a checkpoint */ //static int pager_stmt_rollback( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); //rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, 0); //sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_stmt_commit ID ** ** Commit changes to a checkpoint */ //static int pager_stmt_commit( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int rc; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} /* ** Usage: pager_stats ID ** ** Return pager statistics. */ //static int pager_stats( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int i, *a; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // a = sqlite3PagerStats(pPager); // for(i=0; i<9; i++){ // static char *zName[] = { // "ref", "page", "max", "size", "state", "err", // "hit", "miss", "ovfl", // }; // char zBuf[100]; // Tcl_AppendElement(interp, zName[i]); // sqlite3_snprintf(100, ref zBuf,"%d",a[i]); // Tcl_AppendElement(interp, zBuf); // } // return TCL.TCL_OK; //} /* ** Usage: pager_pagecount ID ** ** Return the size of the database file. */ //static int pager_pagecount( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // char zBuf[100]; // Pgno nPage; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // sqlite3PagerPagecount(pPager, nPage); // sqlite3_snprintf(100, ref zBuf, "%d", nPage); // Tcl_AppendResult(interp, zBuf); // return TCL.TCL_OK; //} /* ** Usage: page_get ID PGNO ** ** Return a pointer to a page from the database. */ //static int page_get( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // char zBuf[100]; // DbPage *pPage; // int pgno; // int rc; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID PGNO\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // if( Tcl_GetInt(interp, argv[2], pgno) ) return TCL.TCL_ERROR; //rc = sqlite3PagerSharedLock(pPager); //if( rc==SQLITE_OK ){ // rc = sqlite3PagerGet(pPager, pgno, &pPage); //} // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // sqlite3_snprintf(100, ref zBuf,"%p",pPage); // Tcl_AppendResult(interp, zBuf); // return TCL.TCL_OK; //} /* ** Usage: page_lookup ID PGNO ** ** Return a pointer to a page if the page is already in cache. ** If not in cache, return an empty string. */ //static int page_lookup( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // char zBuf[100]; // DbPage *pPage; // int pgno; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID PGNO\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // if( Tcl_GetInt(interp, argv[2], pgno) ) return TCL.TCL_ERROR; // pPage = sqlite3PagerLookup(pPager, pgno); // if( pPage ){ // sqlite3_snprintf(100, ref zBuf,"%p",pPage); // Tcl_AppendResult(interp, zBuf); // } // return TCL.TCL_OK; //} /* ** Usage: pager_truncate ID PGNO */ //static int pager_truncate( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // Pager *pPager; // int pgno; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " ID PGNO\"", 0); // return TCL.TCL_ERROR; // } // pPager = sqlite3TestTextToPtr(interp,argv[1].ToString()); // if( Tcl_GetInt(interp, argv[2], pgno) ) return TCL.TCL_ERROR; // sqlite3PagerTruncateImage(pPager, pgno); // return TCL.TCL_OK; //} /* ** Usage: page_unref PAGE ** ** Drop a pointer to a page. */ //static int page_unref( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // DbPage *pPage; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " PAGE\"", 0); // return TCL.TCL_ERROR; // } // pPage = (DbPage *)sqlite3TestTextToPtr(interp,argv[1].ToString()); // sqlite3PagerUnref(pPage); // return TCL.TCL_OK; //} /* ** Usage: page_read PAGE ** ** Return the content of a page */ //static int page_read( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // char zBuf[100]; // DbPage *pPage; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " PAGE\"", 0); // return TCL.TCL_ERROR; // } // pPage = sqlite3TestTextToPtr(interp,argv[1].ToString()); // memcpy(zBuf, sqlite3PagerGetData(pPage), sizeof(zBuf)); // Tcl_AppendResult(interp, zBuf); // return TCL.TCL_OK; //} /* ** Usage: page_number PAGE ** ** Return the page number for a page. */ //static int page_number( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // char zBuf[100]; // DbPage *pPage; // if( argc!=2 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " PAGE\"", 0); // return TCL.TCL_ERROR; // } // pPage = (DbPage *)sqlite3TestTextToPtr(interp,argv[1].ToString()); // sqlite3_snprintf(100, ref zBuf, "%d", sqlite3PagerPagenumber(pPage)); // Tcl_AppendResult(interp, zBuf); // return TCL.TCL_OK; //} /* ** Usage: page_write PAGE DATA ** ** Write something into a page. */ //static int page_write( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // DbPage *pPage; // char *pData; // int rc; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " PAGE DATA\"", 0); // return TCL.TCL_ERROR; // } // pPage = (DbPage *)sqlite3TestTextToPtr(interp,argv[1].ToString()); // rc = sqlite3PagerWrite(pPage); // if( rc!=SQLITE_OK ){ // Tcl_AppendResult(interp, errorName(rc), 0); // return TCL.TCL_ERROR; // } // pData = sqlite3PagerGetData(pPage); // strncpy(pData, argv[2], test_pagesize-1); // pData[test_pagesize-1] = 0; // return TCL.TCL_OK; //} #if !SQLITE_OMIT_DISKIO /* ** Usage: fake_big_file N FILENAME ** ** Write a few bytes at the N megabyte point of FILENAME. This will ** create a large file. If the file was a valid SQLite database, then ** the next time the database is opened, SQLite will begin allocating ** new pages after N. If N is 2096 or bigger, this will test the ** ability of SQLite to write to large files. */ //static int fake_big_file( // object NotUsed, // Tcl_Interp interp, /* The TCL interpreter that invoked this command */ // int argc, /* Number of arguments */ // TclObject[] argv /* Text of each argument */ //){ // sqlite3_vfs *pVfs; // sqlite3_file *fd = 0; // int rc; // int n; // i64 offset; // if( argc!=3 ){ // Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], // " N-MEGABYTES FILE\"", 0); // return TCL.TCL_ERROR; // } // if( Tcl_GetInt(interp, argv[1], n) ) return TCL.TCL_ERROR; // pVfs = sqlite3_vfs_find(0); // rc = sqlite3OsOpenMalloc(pVfs, argv[2], fd, // (SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB), 0 // ); // if( rc !=0){ // Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0); // return TCL.TCL_ERROR; // } // offset = n; // offset *= 1024*1024; // rc = sqlite3OsWrite(fd, "Hello, World!", 14, offset); // sqlite3OsCloseFree(fd); // if( rc !=0){ // Tcl_AppendResult(interp, "write failed: ", errorName(rc), 0); // return TCL.TCL_ERROR; // } // return TCL.TCL_OK; //} #endif /* ** test_control_pending_byte PENDING_BYTE ** ** Set the PENDING_BYTE using the sqlite3_test_control() interface. */ static int testPendingByte( object NotUsed, Tcl_Interp interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ TclObject[] argv /* Text of each argument */ ) { int pbyte = 0; int rc; if (argc != 2) { TCL.Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " PENDING-BYTE\""); } if (TCL.Tcl_GetInt(interp, argv[1], ref pbyte)) { return(TCL.TCL_ERROR); } rc = sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, pbyte); TCL.Tcl_SetObjResult(interp, TCL.Tcl_NewIntObj(rc)); return(TCL.TCL_OK); }
/* ** usage: varint_test START MULTIPLIER COUNT INCREMENT ** ** This command tests the putVarint() and getVarint() ** routines, both for accuracy and for speed. ** ** An integer is written using putVarint() and read back with ** getVarint() and varified to be unchanged. This repeats COUNT ** times. The first integer is START*MULTIPLIER. Each iteration ** increases the integer by INCREMENT. ** ** This command returns nothing if it works. It returns an error message ** if something goes wrong. */ static int btree_varint_test( object NotUsed, Tcl_Interp interp, /* The TCL interpreter that _invoked this command */ int argc, /* Number of arguments */ TclObject[] argv /* Text of each argument */ ) { int start = 0, mult = 0, count = 0, incr = 0; int _in; u32 _out = 0; int n1, n2, i, j; byte[] zBuf = new byte[100]; if (argc != 5) { TCL.Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0].ToString(), " START MULTIPLIER COUNT incrEMENT\"", 0); return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[1], ref start)) { return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[2], ref mult)) { return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[3], ref count)) { return(TCL.TCL_ERROR); } if (TCL.Tcl_GetInt(interp, argv[4], ref incr)) { return(TCL.TCL_ERROR); } _in = start; _in *= mult; for (i = 0; i < count; i++) { string zErr = "";//char zErr[200]; n1 = putVarint(zBuf, 0, _in); if (n1 > 9 || n1 < 1) { sqlite3_snprintf(100, ref zErr, "putVarint returned %d - should be between 1 and 9", n1); TCL.Tcl_AppendResult(interp, zErr); return(TCL.TCL_ERROR); } n2 = getVarint(zBuf, 0, ref _out); if (n1 != n2) { sqlite3_snprintf(100, ref zErr, "putVarint returned %d and GetVar_int returned %d", n1, n2); TCL.Tcl_AppendResult(interp, zErr); return(TCL.TCL_ERROR); } if (_in != (int)_out) { sqlite3_snprintf(100, ref zErr, "Wrote 0x%016llx and got back 0x%016llx", _in, _out); TCL.Tcl_AppendResult(interp, zErr); return(TCL.TCL_ERROR); } if ((_in & 0xffffffff) == _in) { u32 _out32 = 0; n2 = getVarint32(zBuf, ref _out32); _out = _out32; if (n1 != n2) { sqlite3_snprintf(100, ref zErr, "putVarint returned %d and GetVar_int32 returned %d", n1, n2); TCL.Tcl_AppendResult(interp, zErr); return(TCL.TCL_ERROR); } if (_in != (int)_out) { sqlite3_snprintf(100, ref zErr, "Wrote 0x%016llx and got back 0x%016llx from GetVar_int32", _in, _out); TCL.Tcl_AppendResult(interp, zErr); return(TCL.TCL_ERROR); } } /* _in order to get realistic tim_ings, run getVar_int 19 more times. ** This is because getVar_int is called ab_out 20 times more often ** than putVarint. */ for (j = 0; j < 19; j++) { getVarint(zBuf, 0, ref _out); } _in += incr; } return(TCL.TCL_OK); }