Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a couple minor test issues. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | msvc |
Files: | files | file ages | folders |
SHA3-256: |
1f1866d11c2fe3804ebc64cc7a54061c |
User & Date: | mistachkin 2019-04-17 23:56:54.310 |
Context
2019-04-18
| ||
17:37 | Undo change to 'analyze9.test' because the extra output can be useful for debugging. (Leaf check-in: f3081e5909 user: mistachkin tags: msvc) | |
2019-04-17
| ||
23:56 | Fix a couple minor test issues. (check-in: 1f1866d11c user: mistachkin tags: msvc) | |
23:32 | Work around lack of a C99 feature in MSVC. (check-in: f6ebe1c2be user: mistachkin tags: msvc) | |
Changes
Changes to src/test_func.c.
︙ | ︙ | |||
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | sqlite3 *db = sqlite3_context_db_handle(context); u8 *pRec; u8 *pEndHdr; /* Points to one byte past record header */ u8 *pHdr; /* Current point in record header */ u8 *pBody; /* Current point in record data */ u64 nHdr; /* Bytes in record header */ Tcl_Obj *pRet; /* Return value */ pRet = Tcl_NewObj(); Tcl_IncrRefCount(pRet); assert( argc==1 ); pRec = (u8*)sqlite3_value_blob(argv[0]); pHdr = pRec + sqlite3GetVarint(pRec, &nHdr); pBody = pEndHdr = &pRec[nHdr]; while( pHdr<pEndHdr ){ Tcl_Obj *pVal = 0; u64 iSerialType; | > > > > > > > < | | | | | | | | | | | | > | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | sqlite3 *db = sqlite3_context_db_handle(context); u8 *pRec; u8 *pEndHdr; /* Points to one byte past record header */ u8 *pHdr; /* Current point in record header */ u8 *pBody; /* Current point in record data */ u64 nHdr; /* Bytes in record header */ Tcl_Obj *pRet; /* Return value */ Mem *pMem; /* Pointer to memory cell */ pMem = sqlite3_malloc(sizeof(Mem)); if( pMem==0 ){ sqlite3_result_error_nomem(context); return; } pRet = Tcl_NewObj(); Tcl_IncrRefCount(pRet); assert( argc==1 ); pRec = (u8*)sqlite3_value_blob(argv[0]); pHdr = pRec + sqlite3GetVarint(pRec, &nHdr); pBody = pEndHdr = &pRec[nHdr]; while( pHdr<pEndHdr ){ Tcl_Obj *pVal = 0; u64 iSerialType; memset(pMem, 0, sizeof(Mem)); pMem->db = db; pMem->enc = ENC(db); pHdr += sqlite3GetVarint(pHdr, &iSerialType); pBody += sqlite3VdbeSerialGet(pBody, (u32)iSerialType, pMem); switch( sqlite3_value_type(pMem) ){ case SQLITE_TEXT: pVal = Tcl_NewStringObj((const char*)sqlite3_value_text(pMem), -1); break; case SQLITE_BLOB: { char hexdigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; int n = sqlite3_value_bytes(pMem); u8 *z = (u8*)sqlite3_value_blob(pMem); int i; pVal = Tcl_NewStringObj("x'", -1); for(i=0; i<n; i++){ char hex[3]; hex[0] = hexdigit[((z[i] >> 4) & 0x0F)]; hex[1] = hexdigit[(z[i] & 0x0F)]; hex[2] = '\0'; Tcl_AppendStringsToObj(pVal, hex, 0); } Tcl_AppendStringsToObj(pVal, "'", 0); break; } case SQLITE_FLOAT: pVal = Tcl_NewDoubleObj(sqlite3_value_double(pMem)); break; case SQLITE_INTEGER: pVal = Tcl_NewWideIntObj(sqlite3_value_int64(pMem)); break; case SQLITE_NULL: pVal = Tcl_NewStringObj("NULL", -1); break; default: assert( 0 ); } Tcl_ListObjAppendElement(0, pRet, pVal); if( pMem->szMalloc ){ sqlite3DbFree(db, pMem->zMalloc); } } sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT); Tcl_DecrRefCount(pRet); sqlite3_free(pMem); } /* ** test_zeroblob(N) ** ** The implementation of scalar SQL function "test_zeroblob()". This is ** similar to the built-in zeroblob() function, except that it does not |
︙ | ︙ |
Changes to test/analyze9.test.
︙ | ︙ | |||
804 805 806 807 808 809 810 | reset_db execsql { CREATE TABLE t1(a, UNIQUE(a)); INSERT INTO t1 VALUES($two); ANALYZE; } set nByte2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1] | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | reset_db execsql { CREATE TABLE t1(a, UNIQUE(a)); INSERT INTO t1 VALUES($two); ANALYZE; } set nByte2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1] # puts -nonewline " (nByte=$nByte nByte2=$nByte2)" expr {$nByte2 > $nByte+900 && $nByte2 < $nByte+1100} } {1} #------------------------------------------------------------------------- # Test that stat4 data may be used with partial indexes. # |
︙ | ︙ |