From 4fc0fb4358111c29e3c8a0827583caed11fea513 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 7 May 2004 02:26:28 +0000 Subject: [PATCH] Trying to synchronize the test3.c module with the new btree.c code. (CVS 1319) FossilOrigin-Name: 7fd1a660b0607b7c36de1278724521cbea72af0c --- manifest | 14 ++++++------ manifest.uuid | 2 +- src/test3.c | 61 +++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/manifest b/manifest index f61bf3387a..4c3d013461 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scompilation\sproblem\sin\stest5.c\s(CVS\s1318) -D 2004-05-07T01:50:37 +C Trying\sto\ssynchronize\sthe\stest3.c\smodule\swith\sthe\snew\sbtree.c\scode.\s(CVS\s1319) +D 2004-05-07T02:26:28 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -54,7 +54,7 @@ F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895 F src/tclsqlite.c 3a5f8192ed5279a68610102a92a3a9f0cdd09e68 F src/test1.c 9aa62b89d420e6763b5e7ae89a47f6cf87370477 F src/test2.c 9d611c45e1b07039a2bd95f5ea73178362b23229 -F src/test3.c 7d06add423e4a90ec1a2e8d02006f82081109558 +F src/test3.c 3965c323b3a84b1a93e43b412e2c38cd3e3a8e6e F src/test4.c 6e3e31acfaf21d66420fc35fda5b17dc0000cc8d F src/test5.c 3ff0565057b8d23e20092d5c6c0b7cb0d932c51e F src/tokenize.c 6676b946fd8825b67ab52140af4fdc57a70bda48 @@ -190,7 +190,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 71260ff7f7030f56c292b43f83a213c65c9a184e -R 194b5ad3e3513e70d086b1bb91cc9406 -U danielk1977 -Z f28618267aa956a5d19b9055b43e3bc5 +P 49c3c86c17bcd8132216791d7a1a17e2c6256206 +R 121265b7ada7abd612209a97396c18a3 +U drh +Z cd14b2dc0ebca94dac5f612d17c68cb1 diff --git a/manifest.uuid b/manifest.uuid index 1a813c8dc9..45fa084825 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -49c3c86c17bcd8132216791d7a1a17e2c6256206 \ No newline at end of file +7fd1a660b0607b7c36de1278724521cbea72af0c \ No newline at end of file diff --git a/src/test3.c b/src/test3.c index 8f81c78319..b493261e09 100644 --- a/src/test3.c +++ b/src/test3.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test3.c,v 1.24 2004/05/04 17:27:28 drh Exp $ +** $Id: test3.c,v 1.25 2004/05/07 02:26:28 drh Exp $ */ #include "sqliteInt.h" #include "pager.h" @@ -626,7 +626,7 @@ static int btree_delete( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeDelete(pCur); + rc = sqlite3BtreeDelete(pCur); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -655,7 +655,7 @@ static int btree_insert( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeInsert(pCur, argv[2], strlen(argv[2]), + rc = sqlite3BtreeInsert(pCur, argv[2], strlen(argv[2]), argv[3], strlen(argv[3])); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -688,7 +688,7 @@ static int btree_next( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeNext(pCur, &res); + rc = sqlite3BtreeNext(pCur, &res); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -722,7 +722,7 @@ static int btree_prev( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreePrevious(pCur, &res); + rc = sqlite3BtreePrevious(pCur, &res); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -755,7 +755,7 @@ static int btree_first( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeFirst(pCur, &res); + rc = sqlite3BtreeFirst(pCur, &res); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -788,7 +788,7 @@ static int btree_last( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeLast(pCur, &res); + rc = sqlite3BtreeLast(pCur, &res); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -798,6 +798,36 @@ static int btree_last( return SQLITE_OK; } +/* +** Usage: btree_keysize ID +** +** Return the number of bytes of key. +*/ +static int btree_keysize( + void *NotUsed, + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int argc, /* Number of arguments */ + const char **argv /* Text of each argument */ +){ + BtCursor *pCur; + int rc; + u64 n64; + u32 n; + char zBuf[50]; + + if( argc!=2 ){ + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ID\"", 0); + return TCL_ERROR; + } + if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; + sqlite3BtreeKeySize(pCur, &n64); + n = (u32)n64 + sprintf(zBuf, "%u", n); + Tcl_AppendResult(interp, zBuf, 0); + return SQLITE_OK; +} + /* ** Usage: btree_key ID ** @@ -811,7 +841,7 @@ static int btree_key( ){ BtCursor *pCur; int rc; - int n; + u64 n; char *zBuf; if( argc!=2 ){ @@ -820,7 +850,7 @@ static int btree_key( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - sqliteBtreeKeySize(pCur, &n); + sqlite3BtreeKeySize(pCur, &n); zBuf = malloc( n+1 ); rc = sqliteBtreeKey(pCur, 0, n, zBuf); if( rc!=n ){ @@ -860,7 +890,7 @@ static int btree_data( if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; sqliteBtreeDataSize(pCur, &n); zBuf = malloc( n+1 ); - rc = sqliteBtreeData(pCur, 0, n, zBuf); + rc = sqlite3BtreeData(pCur, 0, n, zBuf); if( rc!=n ){ char zMsg[100]; free(zBuf); @@ -886,7 +916,8 @@ static int btree_payload_size( const char **argv /* Text of each argument */ ){ BtCursor *pCur; - int n1, n2; + int n2; + u32 n1; char zBuf[50]; if( argc!=2 ){ @@ -895,8 +926,8 @@ static int btree_payload_size( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - sqliteBtreeKeySize(pCur, &n1); - sqliteBtreeDataSize(pCur, &n2); + sqlite3BtreeKeySize(pCur, &n1); + sqlite3BtreeDataSize(pCur, &n2); sprintf(zBuf, "%d", n1+n2); Tcl_AppendResult(interp, zBuf, 0); return SQLITE_OK; @@ -935,7 +966,7 @@ static int btree_cursor_dump( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR; - rc = sqliteBtreeCursorDump(pCur, aResult); + rc = sqlite3BtreeCursorDump(pCur, aResult); if( rc ){ Tcl_AppendResult(interp, errorName(rc), 0); return TCL_ERROR; @@ -993,7 +1024,5 @@ int Sqlitetest3_Init(Tcl_Interp *interp){ } Tcl_LinkVar(interp, "pager_refinfo_enable", (char*)&pager_refinfo_enable, TCL_LINK_INT); - Tcl_LinkVar(interp, "btree_native_byte_order",(char*)&btree_native_byte_order, - TCL_LINK_INT); return TCL_OK; }