Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Start using sqlite4_num to store numeric SQL values. This commit is more buggy than not. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sqlite4-num |
Files: | files | file ages | folders |
SHA1: |
d94f6e934ecf8db970f6857b96cd0888 |
User & Date: | dan 2013-05-24 20:28:41.556 |
Context
2013-05-25
| ||
16:41 | Fix some bugs in the code that uses sqlite4_num. check-in: 598f3f02f4 user: dan tags: sqlite4-num | |
2013-05-24
| ||
20:28 | Start using sqlite4_num to store numeric SQL values. This commit is more buggy than not. check-in: d94f6e934e user: dan tags: sqlite4-num | |
2013-05-23
| ||
09:39 | Changed TLIBS= to TLIBS?= to allow override from CLI. check-in: 9199b1fa38 user: stephan tags: trunk | |
Changes
Changes to main.mk.
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | $(TOP)/test/test_kv2.c \ $(TOP)/test/test_lsm.c \ $(TOP)/test/test_main.c \ $(TOP)/test/test_malloc.c \ $(TOP)/test/test_mem.c \ $(TOP)/test/test_misc1.c \ $(TOP)/test/test_mutex.c \ $(TOP)/test/test_thread.c \ $(TOP)/test/test_thread0.c \ $(TOP)/test/test_utf.c \ $(TOP)/test/test_wsd.c #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c | > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | $(TOP)/test/test_kv2.c \ $(TOP)/test/test_lsm.c \ $(TOP)/test/test_main.c \ $(TOP)/test/test_malloc.c \ $(TOP)/test/test_mem.c \ $(TOP)/test/test_misc1.c \ $(TOP)/test/test_mutex.c \ $(TOP)/test/test_num.c \ $(TOP)/test/test_thread.c \ $(TOP)/test/test_thread0.c \ $(TOP)/test/test_utf.c \ $(TOP)/test/test_wsd.c #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c |
︙ | ︙ |
Changes to src/math.c.
︙ | ︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 | }else if( n!=SMALLEST_INT64 ){ r.m = -n; }else{ r.m = 1+(u64)LARGEST_INT64; } return r; } /* ** Convert an integer into text in the buffer supplied. The ** text is zero-terminated and right-justified in the buffer. ** A pointer to the first character of text is returned. ** ** The buffer needs to be at least 21 bytes in length. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | }else if( n!=SMALLEST_INT64 ){ r.m = -n; }else{ r.m = 1+(u64)LARGEST_INT64; } return r; } /* ** Return an sqlite4_num containing a value as close as possible to the ** double value passed as the only argument. ** ** TODO: This is an inefficient placeholder implementation only. */ sqlite4_num sqlite4_num_from_double(double d){ const double large = (double)LARGEST_UINT64; const double large10 = (double)TENTH_MAX; sqlite4_num x = {0, 0, 0, 0}; /* TODO: How should this be set? */ x.approx = 1; if( d<0.0 ){ x.sign = 1; d = d*-1.0; } while( d>large || (d>1.0 && d==(i64)d) ){ d = d / 10.0; x.e++; } while( d<large10 && d!=(double)((i64)d) ){ d = d * 10.0; x.e--; } x.m = (u64)d; return x; } /* ** TODO: This is a placeholder implementation only. */ int sqlite4_num_to_int32(sqlite4_num num, int *piOut){ i64 i; sqlite4_num_to_int64(num, &i); *piOut = i; return SQLITE4_OK; } int sqlite4_num_to_double(sqlite4_num num, double *pr){ double rRet; int i; rRet = num.m; if( num.sign ) rRet = rRet*-1; for(i=0; i<num.e; i++){ rRet = rRet * 10.0; } for(i=num.e; i<0; i++){ rRet = rRet / 10.0; } *pr = rRet; return SQLITE4_OK; } int sqlite4_num_to_int64(sqlite4_num num, sqlite4_int64 *piOut){ i64 iRet; int i; iRet = num.m; if( num.sign ) iRet = iRet*-1; for(i=0; i<num.e; i++){ iRet = iRet * 10; } for(i=num.e; i<0; i++){ iRet = iRet / 10; } *piOut = iRet; return SQLITE4_OK; } /* ** Convert an integer into text in the buffer supplied. The ** text is zero-terminated and right-justified in the buffer. ** A pointer to the first character of text is returned. ** ** The buffer needs to be at least 21 bytes in length. |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
4113 4114 4115 4116 4117 4118 4119 | sqlite4_num sqlite4_num_round(sqlite4_num, int iDigit); int sqlite4_num_compare(sqlite4_num, sqlite4_num); sqlite4_num sqlite4_num_from_text(const char*, int n, unsigned flags); sqlite4_num sqlite4_num_from_int64(sqlite4_int64); sqlite4_num sqlite4_num_from_double(double); int sqlite4_num_to_int32(sqlite4_num, int*); int sqlite4_num_to_int64(sqlite4_num, sqlite4_int64*); | | | 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 | sqlite4_num sqlite4_num_round(sqlite4_num, int iDigit); int sqlite4_num_compare(sqlite4_num, sqlite4_num); sqlite4_num sqlite4_num_from_text(const char*, int n, unsigned flags); sqlite4_num sqlite4_num_from_int64(sqlite4_int64); sqlite4_num sqlite4_num_from_double(double); int sqlite4_num_to_int32(sqlite4_num, int*); int sqlite4_num_to_int64(sqlite4_num, sqlite4_int64*); int sqlite4_num_to_double(sqlite4_num, double *); int sqlite4_num_to_text(sqlite4_num, char*); /* ** CAPI4REF: Flags For Text-To-Numeric Conversion */ #define SQLITE4_PREFIX_ONLY 0x10 #define SQLITE4_IGNORE_WHITESPACE 0x20 |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
232 233 234 235 236 237 238 | if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){ double rValue; i64 iValue; u8 enc = pRec->enc; if( (pRec->flags&MEM_Str)==0 ) return; if( sqlite4AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; if( 0==sqlite4Atoi64(pRec->z, &iValue, pRec->n, enc) ){ | | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){ double rValue; i64 iValue; u8 enc = pRec->enc; if( (pRec->flags&MEM_Str)==0 ) return; if( sqlite4AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; if( 0==sqlite4Atoi64(pRec->z, &iValue, pRec->n, enc) ){ pRec->u.num = sqlite4_num_from_int64(iValue); pRec->flags |= MEM_Int; }else{ pRec->u.num = sqlite4_num_from_double(rValue); pRec->flags |= MEM_Real; } } } /* ** Processing is determine by the affinity parameter: |
︙ | ︙ | |||
390 391 392 393 394 395 396 | #ifdef SQLITE4_DEBUG /* ** Print the value of a register for tracing purposes: */ static void memTracePrint(FILE *out, Mem *p){ if( p->flags & MEM_Null ){ fprintf(out, " NULL"); | > > > > | < > | < < | > | < | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | #ifdef SQLITE4_DEBUG /* ** Print the value of a register for tracing purposes: */ static void memTracePrint(FILE *out, Mem *p){ if( p->flags & MEM_Null ){ fprintf(out, " NULL"); }else if( p->flags & (MEM_Int|MEM_Real) ){ char aNum[31]; char *zFlags = "r"; sqlite4_num_to_text(p->u.num, aNum); if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){ zFlags = "si"; }else if( p->flags & MEM_Int ){ zFlags = "i"; } fprintf(out, " %s:%s", zFlags, aNum); }else if( p->flags & MEM_RowSet ){ fprintf(out, " (keyset)"); }else{ char zBuf[200]; sqlite4VdbeMemPrettyPrint(p, zBuf); fprintf(out, " "); fprintf(out, "%s", zBuf); |
︙ | ︙ | |||
718 719 720 721 722 723 724 | */ case OP_Gosub: { /* jump */ assert( pOp->p1>0 && pOp->p1<=p->nMem ); pIn1 = &aMem[pOp->p1]; assert( (pIn1->flags & MEM_Dyn)==0 ); memAboutToChange(p, pIn1); pIn1->flags = MEM_Int; | | | | | | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | */ case OP_Gosub: { /* jump */ assert( pOp->p1>0 && pOp->p1<=p->nMem ); pIn1 = &aMem[pOp->p1]; assert( (pIn1->flags & MEM_Dyn)==0 ); memAboutToChange(p, pIn1); pIn1->flags = MEM_Int; pIn1->u.num = sqlite4_num_from_int64((i64)pc); REGISTER_TRACE(pOp->p1, pIn1); pc = pOp->p2 - 1; break; } /* Opcode: Return P1 * * * * ** ** Jump to the next instruction after the address in register P1. */ case OP_Return: { /* in1 */ pIn1 = &aMem[pOp->p1]; assert( pIn1->flags & MEM_Int ); sqlite4_num_to_int32(pIn1->u.num, &pc); break; } /* Opcode: Yield P1 * * * * ** ** Swap the program counter with the value in register P1. */ case OP_Yield: { /* in1 */ int pcDest; pIn1 = &aMem[pOp->p1]; assert( (pIn1->flags & MEM_Dyn)==0 ); pIn1->flags = MEM_Int; sqlite4_num_to_int32(pIn1->u.num, &pcDest); pIn1->u.num = sqlite4_num_from_int64(pc); REGISTER_TRACE(pOp->p1, pIn1); pc = pcDest; break; } /* Opcode: HaltIfNull P1 P2 P3 P4 * ** |
︙ | ︙ | |||
834 835 836 837 838 839 840 | } /* Opcode: Integer P1 P2 * * * ** ** The 32-bit integer value P1 is written into register P2. */ case OP_Integer: { /* out2-prerelease */ | | | | | 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | } /* Opcode: Integer P1 P2 * * * ** ** The 32-bit integer value P1 is written into register P2. */ case OP_Integer: { /* out2-prerelease */ pOut->u.num = sqlite4_num_from_int64((i64)pOp->p1); break; } /* Opcode: Int64 * P2 * P4 * ** ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ case OP_Int64: { /* out2-prerelease */ assert( pOp->p4.pI64!=0 ); pOut->u.num = sqlite4_num_from_int64(*pOp->p4.pI64); break; } #ifndef SQLITE4_OMIT_FLOATING_POINT /* Opcode: Real * P2 * P4 * ** ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ case OP_Real: { /* same as TK_FLOAT, out2-prerelease */ pOut->flags = MEM_Real; assert( !sqlite4IsNaN(*pOp->p4.pReal) ); pOut->u.num = sqlite4_num_from_double(*pOp->p4.pReal); break; } #endif /* Opcode: String8 * P2 * P4 * ** ** P4 points to a nul terminated UTF-8 string. This opcode is transformed |
︙ | ︙ | |||
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */ case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */ case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ int flags; /* Combined MEM_* flags from both inputs */ i64 iA; /* Integer value of left operand */ i64 iB; /* Integer value of right operand */ double rA; /* Real value of left operand */ double rB; /* Real value of right operand */ pIn1 = &aMem[pOp->p1]; applyNumericAffinity(pIn1); pIn2 = &aMem[pOp->p2]; applyNumericAffinity(pIn2); pOut = &aMem[pOp->p3]; flags = pIn1->flags | pIn2->flags; if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null; if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){ iA = pIn1->u.i; iB = pIn2->u.i; switch( pOp->opcode ){ case OP_Add: if( sqlite4AddInt64(&iB,iA) ) goto fp_math; break; case OP_Subtract: if( sqlite4SubInt64(&iB,iA) ) goto fp_math; break; case OP_Multiply: if( sqlite4MulInt64(&iB,iA) ) goto fp_math; break; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 | case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */ case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */ case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ int flags; /* Combined MEM_* flags from both inputs */ i64 iA; /* Integer value of left operand */ i64 iB; /* Integer value of right operand */ #if 0 double rA; /* Real value of left operand */ double rB; /* Real value of right operand */ #endif pIn1 = &aMem[pOp->p1]; applyNumericAffinity(pIn1); pIn2 = &aMem[pOp->p2]; applyNumericAffinity(pIn2); pOut = &aMem[pOp->p3]; flags = pIn1->flags | pIn2->flags; if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null; switch( pOp->opcode ){ case OP_Add: pOut->u.num = sqlite4_num_add(pIn1->u.num, pIn2->u.num); break; case OP_Subtract: pOut->u.num = sqlite4_num_sub(pIn1->u.num, pIn2->u.num); break; case OP_Multiply: pOut->u.num = sqlite4_num_mul(pIn1->u.num, pIn2->u.num); break; case OP_Divide: pOut->u.num = sqlite4_num_div(pIn1->u.num, pIn2->u.num); break; default: { sqlite4_num_to_int64(pIn1->u.num, &iA); sqlite4_num_to_int64(pIn1->u.num, &iB); if( iA==0 ) goto arithmetic_result_is_null; pOut->u.num = sqlite4_num_from_int64(iB % iA); break; } } if( sqlite4_num_isnan(pOut->u.num) ){ goto arithmetic_result_is_null; }else{ pOut->flags &= ~MEM_TypeMask; pOut->flags |= MEM_Real; sqlite4VdbeIntegerAffinity(pOut); } break; #if 0 if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){ iA = pIn1->u.i; iB = pIn2->u.i; switch( pOp->opcode ){ case OP_Add: if( sqlite4AddInt64(&iB,iA) ) goto fp_math; break; case OP_Subtract: if( sqlite4SubInt64(&iB,iA) ) goto fp_math; break; case OP_Multiply: if( sqlite4MulInt64(&iB,iA) ) goto fp_math; break; |
︙ | ︙ | |||
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | MemSetTypeFlag(pOut, MEM_Real); if( (flags & MEM_Real)==0 ){ sqlite4VdbeIntegerAffinity(pOut); } #endif } break; arithmetic_result_is_null: sqlite4VdbeMemSetNull(pOut); break; } /* Opcode: CollSeq * * P4 | > | 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | MemSetTypeFlag(pOut, MEM_Real); if( (flags & MEM_Real)==0 ){ sqlite4VdbeIntegerAffinity(pOut); } #endif } break; #endif arithmetic_result_is_null: sqlite4VdbeMemSetNull(pOut); break; } /* Opcode: CollSeq * * P4 |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | uA >>= iB; /* Sign-extend on a right shift of a negative number */ if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB); } memcpy(&iA, &uA, sizeof(iA)); } } | > | | | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | uA >>= iB; /* Sign-extend on a right shift of a negative number */ if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB); } memcpy(&iA, &uA, sizeof(iA)); } } pOut->u.num = sqlite4_num_from_int64(iA); MemSetTypeFlag(pOut, MEM_Int); break; } /* Opcode: AddImm P1 P2 * * * ** ** Add the constant P2 to the value in register P1. ** The result is always an integer. ** ** To force any register to be an integer, just add 0. */ case OP_AddImm: { /* in1 */ pIn1 = &aMem[pOp->p1]; memAboutToChange(p, pIn1); sqlite4VdbeMemIntegerify(pIn1); pIn1->u.num = sqlite4_num_add(pIn1->u.num, sqlite4_num_from_int64(1)); break; } /* Opcode: MustBeInt P1 P2 * * * ** ** Force the value in register P1 to be an integer. If the value ** in P1 is not an integer and cannot be converted into an integer |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | default: res = res>=0; break; } if( pOp->p5 & SQLITE4_STOREP2 ){ pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); MemSetTypeFlag(pOut, MEM_Int); | | | 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | default: res = res>=0; break; } if( pOp->p5 & SQLITE4_STOREP2 ){ pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); MemSetTypeFlag(pOut, MEM_Int); pOut->u.num = sqlite4_num_from_int64(res); REGISTER_TRACE(pOp->p2, pOut); }else if( res ){ pc = pOp->p2-1; } /* Undo any changes made by applyAffinity() to the input registers. */ pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (flags1&MEM_TypeMask); |
︙ | ︙ | |||
1947 1948 1949 1950 1951 1952 1953 | static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 }; v1 = or_logic[v1*3+v2]; } pOut = &aMem[pOp->p3]; if( v1==2 ){ MemSetTypeFlag(pOut, MEM_Null); }else{ | | | 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 }; v1 = or_logic[v1*3+v2]; } pOut = &aMem[pOp->p3]; if( v1==2 ){ MemSetTypeFlag(pOut, MEM_Null); }else{ pOut->u.num = sqlite4_num_from_int64(v1); MemSetTypeFlag(pOut, MEM_Int); } break; } /* Opcode: Not P1 P2 * * * ** |
︙ | ︙ | |||
2550 2551 2552 2553 2554 2555 2556 | ** size, and so forth. P1==0 is the main database file and P1==1 is the ** database file used to store temporary tables. ** ** A transaction must be started before executing this opcode. */ case OP_SetCookie: { /* in3 */ Db *pDb; | | | | | | 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 | ** size, and so forth. P1==0 is the main database file and P1==1 is the ** database file used to store temporary tables. ** ** A transaction must be started before executing this opcode. */ case OP_SetCookie: { /* in3 */ Db *pDb; i64 v; assert( pOp->p1>=0 && pOp->p1<db->nDb ); pDb = &db->aDb[pOp->p1]; pIn3 = &aMem[pOp->p3]; sqlite4VdbeMemIntegerify(pIn3); sqlite4_num_to_int64(pIn3->u.num, &v); rc = sqlite4KVStorePutSchema(pDb->pKV, (u32)v); pDb->pSchema->schema_cookie = (int)v; db->flags |= SQLITE4_InternChanges; if( pOp->p1==1 ){ /* Invalidate all prepared statements whenever the TEMP database ** schema is changed. Ticket #1644 */ sqlite4ExpirePreparedStatements(db); p->expired = 0; } |
︙ | ︙ | |||
2706 2707 2708 2709 2710 2711 2712 | if( pOp->p5 ){ assert( p2>0 ); assert( p2<=p->nMem ); pIn2 = &aMem[p2]; assert( memIsValid(pIn2) ); assert( (pIn2->flags & MEM_Int)!=0 ); sqlite4VdbeMemIntegerify(pIn2); | | | 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 | if( pOp->p5 ){ assert( p2>0 ); assert( p2<=p->nMem ); pIn2 = &aMem[p2]; assert( memIsValid(pIn2) ); assert( (pIn2->flags & MEM_Int)!=0 ); sqlite4VdbeMemIntegerify(pIn2); sqlite4_num_to_int32(pIn2->u.num, &p2); /* The p2 value always comes from a prior OP_NewIdxid opcode and ** that opcode will always set the p2 value to 2 or more or else fail. ** If there were a failure, the prepared statement would have halted ** before reaching this instruction. */ if( NEVER(p2<2) ) { rc = SQLITE4_CORRUPT_BKPT; goto abort_due_to_error; |
︙ | ︙ | |||
3238 3239 3240 3241 3242 3243 3244 | ** Write the sequence number into register P2. ** The sequence number on the cursor is incremented after this ** instruction. */ case OP_Sequence: { /* out2-prerelease */ assert( pOp->p1>=0 && pOp->p1<p->nCursor ); assert( p->apCsr[pOp->p1]!=0 ); | | > | 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 | ** Write the sequence number into register P2. ** The sequence number on the cursor is incremented after this ** instruction. */ case OP_Sequence: { /* out2-prerelease */ assert( pOp->p1>=0 && pOp->p1<p->nCursor ); assert( p->apCsr[pOp->p1]!=0 ); pOut->u.num = sqlite4_num_from_int64(p->apCsr[pOp->p1]->seqCount++); break; } /* Opcode: NewRowid P1 P2 P3 * * ** ** Get a new integer primary key (a.k.a "rowid") for table P1. The integer ** should not be currently in use as a primary key on that table. ** ** If P3 is not zero, then it is the number of a register in the top-level ** frame that holds a lower bound for the new rowid. In other words, the ** new rowid must be no less than reg[P3]+1. */ case OP_NewRowid: { /* out2-prerelease */ i64 v; /* The new rowid */ VdbeCursor *pC; /* Cursor of table to get the new rowid */ const KVByteArray *aKey; /* Key of an existing row */ KVSize nKey; /* Size of the existing row key */ int n; /* Number of bytes decoded */ i64 i3; /* Integer value from pIn3 */ v = 0; assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); /* Some compilers complain about constants of the form 0x7fffffffffffffff. |
︙ | ︙ | |||
3309 3310 3311 3312 3313 3314 3315 | #ifndef SQLITE_OMIT_AUTOINCREMENT if( pOp->p3 && rc==SQLITE4_OK ){ pIn3 = sqlite4RegisterInRootFrame(p, pOp->p3); assert( memIsValid(pIn3) ); REGISTER_TRACE(pOp->p3, pIn3); sqlite4VdbeMemIntegerify(pIn3); assert( (pIn3->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */ | > | | | > | 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 | #ifndef SQLITE_OMIT_AUTOINCREMENT if( pOp->p3 && rc==SQLITE4_OK ){ pIn3 = sqlite4RegisterInRootFrame(p, pOp->p3); assert( memIsValid(pIn3) ); REGISTER_TRACE(pOp->p3, pIn3); sqlite4VdbeMemIntegerify(pIn3); assert( (pIn3->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */ sqlite4_num_to_int64(pIn3->u.num, &i3); if( i3==MAX_ROWID ){ rc = SQLITE4_FULL; } if( v<i3 ) v = i3; } #endif pOut->flags = MEM_Int; pOut->u.num = sqlite4_num_from_int64(v+1); break; } /* Opcode: NewIdxid P1 P2 * * * ** ** This opcode is used to allocated new integer index numbers. P1 must ** be an integer value when this opcode is invoked. Before the opcode ** concludes, P1 is set to a value 1 greater than the larger of: ** ** * its current value, or ** * the largest index number still visible in the database using the ** LEFAST query mode used by OP_NewRowid in database P2. */ case OP_NewIdxid: { /* in1 */ u64 iMax; i64 i1; KVStore *pKV; KVCursor *pCsr; pKV = db->aDb[pOp->p2].pKV; pIn1 = &aMem[pOp->p1]; iMax = 0; assert( pIn1->flags & MEM_Int ); |
︙ | ︙ | |||
3357 3358 3359 3360 3361 3362 3363 | } }else if( rc==SQLITE4_NOTFOUND ){ rc = SQLITE4_OK; } sqlite4KVCursorClose(pCsr); } | > | | | > | 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 | } }else if( rc==SQLITE4_NOTFOUND ){ rc = SQLITE4_OK; } sqlite4KVCursorClose(pCsr); } sqlite4_num_to_int64(pIn1->u.num, &i1); if( i1>=(i64)iMax ){ i1++; }else{ i1 = iMax+1; } pIn1->u.num = sqlite4_num_from_int64(i1); break; } /* Opcode: Insert P1 P2 P3 P4 P5 ** ** Write an entry into the table of cursor P1. A new entry is |
︙ | ︙ | |||
3423 3424 3425 3426 3427 3428 3429 | REGISTER_TRACE(pOp->p2, pData); if( pOp->opcode==OP_Insert ){ pKey = &aMem[pOp->p3]; assert( pKey->flags & MEM_Int ); assert( memIsValid(pKey) ); REGISTER_TRACE(pOp->p3, pKey); | | | 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 | REGISTER_TRACE(pOp->p2, pData); if( pOp->opcode==OP_Insert ){ pKey = &aMem[pOp->p3]; assert( pKey->flags & MEM_Int ); assert( memIsValid(pKey) ); REGISTER_TRACE(pOp->p3, pKey); sqlite4_num_to_int64(pKey->u.num, &iKey); }else{ /* assert( pOp->opcode==OP_InsertInt ); */ iKey = pOp->p3; } if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; if( pData->flags & MEM_Null ){ |
︙ | ︙ | |||
3615 3616 3617 3618 3619 3620 3621 | rc = sqlite4KVCursorKey(pC->pKVCur, &aKey, &nKey); if( rc==SQLITE4_OK ){ n = sqlite4GetVarint64(aKey, nKey, (sqlite4_uint64*)&v); n = sqlite4VdbeDecodeIntKey(&aKey[n], nKey-n, &v); if( n==0 ) rc = SQLITE4_CORRUPT; } } | | | 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 | rc = sqlite4KVCursorKey(pC->pKVCur, &aKey, &nKey); if( rc==SQLITE4_OK ){ n = sqlite4GetVarint64(aKey, nKey, (sqlite4_uint64*)&v); n = sqlite4VdbeDecodeIntKey(&aKey[n], nKey-n, &v); if( n==0 ) rc = SQLITE4_CORRUPT; } } pOut->u.num = sqlite4_num_from_int64(v); break; } /* Opcode: NullRow P1 * * * * ** ** Move the cursor P1 to a null row. Any OP_Column operations ** that occur while the cursor is on the null row will always |
︙ | ︙ | |||
4277 4278 4279 4280 4281 4282 4283 4284 | ** within a sub-program). Set the value of register P1 to the maximum of ** its current value and the value in register P2. ** ** This instruction throws an error if the memory cell is not initially ** an integer. */ case OP_MemMax: { /* in2 */ Mem *pIn1; | > > < | | > > > | > > | > > > | > | | 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 | ** within a sub-program). Set the value of register P1 to the maximum of ** its current value and the value in register P2. ** ** This instruction throws an error if the memory cell is not initially ** an integer. */ case OP_MemMax: { /* in2 */ i64 i1; i64 i2; Mem *pIn1; pIn1 = sqlite4RegisterInRootFrame(p, pOp->p1); assert( memIsValid(pIn1) ); sqlite4VdbeMemIntegerify(pIn1); pIn2 = &aMem[pOp->p2]; REGISTER_TRACE(pOp->p1, pIn1); sqlite4VdbeMemIntegerify(pIn2); sqlite4_num_to_int64(pIn1->u.num, &i1); sqlite4_num_to_int64(pIn2->u.num, &i2); if( i1<i2 ){ pIn1->u.num = sqlite4_num_from_int64(i2); } REGISTER_TRACE(pOp->p1, pIn1); break; } #endif /* SQLITE4_OMIT_AUTOINCREMENT */ /* Opcode: IfPos P1 P2 * * * ** ** If the value of register P1 is 1 or greater, jump to P2. ** ** It is illegal to use this instruction on a register that does ** not contain an integer. An assertion fault will result if you try. */ case OP_IfPos: { /* jump, in1 */ i64 i1; pIn1 = &aMem[pOp->p1]; assert( pIn1->flags&MEM_Int ); sqlite4_num_to_int64(pIn1->u.num, &i1); if( i1>0 ){ pc = pOp->p2 - 1; } break; } /* Opcode: IfNeg P1 P2 * * * ** ** If the value of register P1 is less than zero, jump to P2. ** ** It is illegal to use this instruction on a register that does ** not contain an integer. An assertion fault will result if you try. */ case OP_IfNeg: { /* jump, in1 */ i64 i1; pIn1 = &aMem[pOp->p1]; assert( pIn1->flags&MEM_Int ); sqlite4_num_to_int64(pIn1->u.num, &i1); if( i1<0 ){ pc = pOp->p2 - 1; } break; } /* Opcode: IfZero P1 P2 P3 * * ** ** The register P1 must contain an integer. Add literal P3 to the ** value in register P1. If the result is exactly 0, jump to P2. ** ** It is illegal to use this instruction on a register that does ** not contain an integer. An assertion fault will result if you try. */ case OP_IfZero: { /* jump, in1 */ i64 i1; pIn1 = &aMem[pOp->p1]; assert( pIn1->flags&MEM_Int ); sqlite4_num_to_int64(pIn1->u.num, &i1); i1 += pOp->p3; pIn1->u.num = sqlite4_num_from_int64(i1); if( i1==0 ){ pc = pOp->p2 - 1; } break; } /* Opcode: AggStep * P2 P3 P4 P5 ** |
︙ | ︙ | |||
4879 4880 4881 4882 4883 4884 4885 | ** of the fts index to update. If it is zero, then the root page of the ** index is available as part of the Fts5Info structure. */ case OP_FtsUpdate: { Fts5Info *pInfo; /* Description of fts5 index to update */ Mem *pKey; /* Primary key of indexed row */ Mem *aArg; /* Pointer to array of N arguments */ | | < | > < > | > | < | 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 | ** of the fts index to update. If it is zero, then the root page of the ** index is available as part of the Fts5Info structure. */ case OP_FtsUpdate: { Fts5Info *pInfo; /* Description of fts5 index to update */ Mem *pKey; /* Primary key of indexed row */ Mem *aArg; /* Pointer to array of N arguments */ int iRoot; /* Root page number (or 0) */ assert( pOp->p4type==P4_FTS5INFO ); pInfo = pOp->p4.pFtsInfo; aArg = &aMem[pOp->p3]; pKey = &aMem[pOp->p1]; if( pOp->p2 ){ sqlite4_num_to_int32(aMem[pOp->p2].u.num, &iRoot); }else{ iRoot = 0; } rc = sqlite4Fts5Update(db, pInfo, iRoot, pKey, aArg, pOp->p5, &p->zErrMsg); break; } /* ** Opcode: FtsCksum P1 * P3 P4 P5 ** ** This opcode is used by the integrity-check procedure that verifies that ** the contents of an fts5 index and its corresponding table match. */ case OP_FtsCksum: { Fts5Info *pInfo; /* Description of fts5 index to update */ Mem *pKey; /* Primary key of row */ Mem *aArg; /* Pointer to array of N values */ i64 cksum; /* Checksum for this row or index entry */ i64 i1; assert( pOp->p4type==P4_FTS5INFO ); pInfo = pOp->p4.pFtsInfo; pOut = &aMem[pOp->p1]; pKey = &aMem[pOp->p3]; aArg = &aMem[pOp->p3+1]; cksum = 0; if( pOp->p5 ){ sqlite4Fts5EntryCksum(db, pInfo, pKey, aArg, &cksum); }else{ sqlite4Fts5RowCksum(db, pInfo, pKey, aArg, &cksum); } sqlite4_num_to_int64(pOut->u.num, &i1); pOut->u.num = sqlite4_num_from_int64(i1 ^ cksum); break; } /* Opcode: FtsOpen P1 P2 P3 P4 P5 ** ** Open an FTS cursor named P1. P4 points to an Fts5Info object. ** ** Register P3 contains the MATCH expression that this cursor will iterate ** through the matches for. P5 is set to 0 to iterate through the results ** in ascending PK order, or 1 for descending PK order. ** ** If the expression matches zero rows, jump to instruction P2. Otherwise, ** leave the cursor pointing at the first match and fall through to the ** next instruction. */ case OP_FtsOpen: { /* jump */ Fts5Info *pInfo; /* Description of fts5 index to update */ VdbeCursor *pCur; char *zMatch; Mem *pMatch; pMatch = &aMem[pOp->p3]; Stringify(pMatch, encoding); zMatch = pMatch->z; |
︙ | ︙ |
Changes to src/vdbe.h.
︙ | ︙ | |||
214 215 216 217 218 219 220 | void sqlite4VdbeSetVarmask(Vdbe*, int); #ifndef SQLITE4_OMIT_TRACE char *sqlite4VdbeExpandSql(Vdbe*, const char*); #endif sqlite4_value *sqlite4ColumnValue(sqlite4_stmt *pStmt, int iCol); void sqlite4VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); | < | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | void sqlite4VdbeSetVarmask(Vdbe*, int); #ifndef SQLITE4_OMIT_TRACE char *sqlite4VdbeExpandSql(Vdbe*, const char*); #endif sqlite4_value *sqlite4ColumnValue(sqlite4_stmt *pStmt, int iCol); void sqlite4VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); UnpackedRecord *sqlite4VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **); #ifndef SQLITE4_OMIT_TRIGGER void sqlite4VdbeLinkSubProgram(Vdbe *, SubProgram *); #endif |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
126 127 128 129 130 131 132 | ** Internally, the vdbe manipulates nearly all SQL values as Mem ** structures. Each Mem struct may cache multiple representations (string, ** integer etc.) of the same value. */ struct Mem { sqlite4 *db; /* The associated database connection */ char *z; /* String or BLOB value */ | < | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | ** Internally, the vdbe manipulates nearly all SQL values as Mem ** structures. Each Mem struct may cache multiple representations (string, ** integer etc.) of the same value. */ struct Mem { sqlite4 *db; /* The associated database connection */ char *z; /* String or BLOB value */ union { sqlite4_num num; /* Numeric value used by MEM_Int and/or MEM_Real */ FuncDef *pDef; /* Used only when flags==MEM_Agg */ RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ } u; int n; /* Number of characters in string value, excluding '\0' */ u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ u8 type; /* One of SQLITE4_NULL, _TEXT, _INTEGER, etc */ u8 enc; /* SQLITE4_UTF8, SQLITE4_UTF16BE, SQLITE4_UTF16LE */ #ifdef SQLITE4_DEBUG Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ #endif void (*xDel)(void*,void*); /* Function to delete Mem.z */ void *pDelArg; /* First argument to xDel() */ |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
668 669 670 671 672 673 674 | ** these assert()s from failing, when building with SQLITE4_DEBUG defined ** using gcc, we force nullMem to be 8-byte aligned using the magical ** __attribute__((aligned(8))) macro. */ static const Mem nullMem #if defined(SQLITE4_DEBUG) && defined(__GNUC__) __attribute__((aligned(8))) #endif | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | ** these assert()s from failing, when building with SQLITE4_DEBUG defined ** using gcc, we force nullMem to be 8-byte aligned using the magical ** __attribute__((aligned(8))) macro. */ static const Mem nullMem #if defined(SQLITE4_DEBUG) && defined(__GNUC__) __attribute__((aligned(8))) #endif = {0, "", {{0,0,0,0}}, 0, MEM_Null, SQLITE4_NULL, 0, #ifdef SQLITE4_DEBUG 0, 0, /* pScopyFrom, pFiller */ #endif 0, 0 }; if( pVm && ALWAYS(pVm->db) ){ sqlite4_mutex_enter(pVm->db->mutex); |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | return bindText(pStmt, i, zData, nData, xDel, pDelArg, SQLITE4_UTF16NATIVE); } #endif /* SQLITE4_OMIT_UTF16 */ int sqlite4_bind_value(sqlite4_stmt *pStmt, int i, const sqlite4_value *pValue){ int rc; switch( pValue->type ){ case SQLITE4_INTEGER: { | > > | > > | | 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | return bindText(pStmt, i, zData, nData, xDel, pDelArg, SQLITE4_UTF16NATIVE); } #endif /* SQLITE4_OMIT_UTF16 */ int sqlite4_bind_value(sqlite4_stmt *pStmt, int i, const sqlite4_value *pValue){ int rc; switch( pValue->type ){ case SQLITE4_INTEGER: { i64 i1; sqlite4_num_to_int64(pValue->u.num, &i1); rc = sqlite4_bind_int64(pStmt, i, i1); break; } case SQLITE4_FLOAT: { double r; sqlite4_num_to_double(pValue->u.num, &r); rc = sqlite4_bind_double(pStmt, i, r); break; } case SQLITE4_BLOB: { rc = sqlite4_bind_blob(pStmt, i, pValue->z, pValue->n, SQLITE4_TRANSIENT, 0); break; } |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
896 897 898 899 900 901 902 | sqlite4_snprintf(zTemp, nTemp, "%.16g", *pOp->p4.pReal); break; } case P4_MEM: { Mem *pMem = pOp->p4.pMem; if( pMem->flags & MEM_Str ){ zP4 = pMem->z; | | | | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | sqlite4_snprintf(zTemp, nTemp, "%.16g", *pOp->p4.pReal); break; } case P4_MEM: { Mem *pMem = pOp->p4.pMem; if( pMem->flags & MEM_Str ){ zP4 = pMem->z; }else if( pMem->flags & (MEM_Int|MEM_Real) ){ char aOut[30]; sqlite4_num_to_text(pMem->u.num, aOut); sqlite4_snprintf(zTemp, nTemp, "%s", aOut); }else if( pMem->flags & MEM_Null ){ sqlite4_snprintf(zTemp, nTemp, "NULL"); }else{ assert( pMem->flags & MEM_Blob ); zP4 = "(blob)"; } break; |
︙ | ︙ | |||
1129 1130 1131 1132 1133 1134 1135 | i -= apSub[j]->nOp; } pOp = &apSub[j]->aOp[i]; } if( p->explain==1 ){ pMem->flags = MEM_Int; pMem->type = SQLITE4_INTEGER; | | | | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | i -= apSub[j]->nOp; } pOp = &apSub[j]->aOp[i]; } if( p->explain==1 ){ pMem->flags = MEM_Int; pMem->type = SQLITE4_INTEGER; pMem->u.num = sqlite4_num_from_int64(i); /* Program counter */ pMem++; pMem->flags = MEM_Static|MEM_Str|MEM_Term; pMem->z = (char*)sqlite4OpcodeName(pOp->opcode); /* Opcode */ assert( pMem->z!=0 ); pMem->n = sqlite4Strlen30(pMem->z); pMem->type = SQLITE4_TEXT; pMem->enc = SQLITE4_UTF8; pMem++; /* When an OP_Program opcode is encounter (the only opcode that has |
︙ | ︙ | |||
1161 1162 1163 1164 1165 1166 1167 | pSub->flags |= MEM_Blob; pSub->n = nSub*sizeof(SubProgram*); } } } pMem->flags = MEM_Int; | | | | | | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | pSub->flags |= MEM_Blob; pSub->n = nSub*sizeof(SubProgram*); } } } pMem->flags = MEM_Int; pMem->u.num = sqlite4_num_from_int64(pOp->p1); /* P1 */ pMem->type = SQLITE4_INTEGER; pMem++; pMem->flags = MEM_Int; pMem->u.num = sqlite4_num_from_int64(pOp->p2); /* P2 */ pMem->type = SQLITE4_INTEGER; pMem++; pMem->flags = MEM_Int; pMem->u.num = sqlite4_num_from_int64(pOp->p3); /* P3 */ pMem->type = SQLITE4_INTEGER; pMem++; if( sqlite4VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ assert( p->db->mallocFailed ); return SQLITE4_ERROR; } pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; z = displayP4(pOp, pMem->z, 32); if( z!=pMem->z ){ sqlite4VdbeMemSetStr(pMem, z, -1, SQLITE4_UTF8, 0, 0); |
︙ | ︙ | |||
2134 2135 2136 2137 2138 2139 2140 | p->pNext->pPrev = p->pPrev; } p->magic = VDBE_MAGIC_DEAD; p->db = 0; sqlite4VdbeDeleteObject(db, p); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | p->pNext->pPrev = p->pPrev; } p->magic = VDBE_MAGIC_DEAD; p->db = 0; sqlite4VdbeDeleteObject(db, p); } /* ** If we are on an architecture with mixed-endian floating ** points (ex: ARM7) then swap the lower 4 bytes with the ** upper 4 bytes. Return the result. ** ** For most architectures, this is a no-op. ** |
︙ | ︙ | |||
2282 2283 2284 2285 2286 2287 2288 | return u.r; } # define swapMixedEndianFloat(X) X = floatSwap(X) #else # define swapMixedEndianFloat(X) #endif | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 | return u.r; } # define swapMixedEndianFloat(X) X = floatSwap(X) #else # define swapMixedEndianFloat(X) #endif /* ** This routine is used to allocate sufficient space for an UnpackedRecord ** structure large enough to be used with sqlite4VdbeRecordUnpack() if ** the first argument is a pointer to KeyInfo structure pKeyInfo. ** ** The space is either allocated using sqlite4DbMallocRaw() or from within |
︙ | ︙ | |||
2479 2480 2481 2482 2483 2484 2485 | p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; p->pKeyInfo = pKeyInfo; p->nField = pKeyInfo->nField + 1; return p; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 | p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; p->pKeyInfo = pKeyInfo; p->nField = pKeyInfo->nField + 1; return p; } /* ** This routine sets the value to be returned by subsequent calls to ** sqlite4_changes() on the database handle 'db'. */ void sqlite4VdbeSetChanges(sqlite4 *db, int nChange){ assert( sqlite4_mutex_held(db->mutex) ); |
︙ | ︙ |
Changes to src/vdbecodec.c.
︙ | ︙ | |||
225 226 227 228 229 230 231 | } nOut = 9; for(i=0; i<nIn; i++){ int flags = aIn[i].flags; if( flags & MEM_Null ){ aOut[nOut++] = 0; }else if( flags & MEM_Int ){ | > > | | > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } nOut = 9; for(i=0; i<nIn; i++){ int flags = aIn[i].flags; if( flags & MEM_Null ){ aOut[nOut++] = 0; }else if( flags & MEM_Int ){ i64 i1; sqlite4_num_to_int64(aIn[i].u.num, &i1); n = significantBytes(i1); aOut[nOut++] = n+2; nPayload += n; aAux[i].n = n; }else if( flags & MEM_Real ){ int e = 0; u8 sign = 0; double r; sqlite4_uint64 m; sqlite4_num_to_double(aIn[i].u.num, &r); if( sqlite4IsNaN(r) ){ m = 0; e = 2; }else if( sqlite4IsInf(r)!=0 ){ m = 1; e = 2 + (sqlite4IsInf(r)<0); }else{ |
︙ | ︙ | |||
285 286 287 288 289 290 291 | aOut = sqlite4DbReallocOrFree(db, aOut, nOut + nPayload); if( aOut==0 ){ rc = SQLITE4_NOMEM; goto vdbeEncodeData_error; } for(i=0; i<nIn; i++){ int flags = aIn[i].flags; if( flags & MEM_Null ){ /* No content */ }else if( flags & MEM_Int ){ | | > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | aOut = sqlite4DbReallocOrFree(db, aOut, nOut + nPayload); if( aOut==0 ){ rc = SQLITE4_NOMEM; goto vdbeEncodeData_error; } for(i=0; i<nIn; i++){ int flags = aIn[i].flags; if( flags & MEM_Null ){ /* No content */ }else if( flags & MEM_Int ){ sqlite4_int64 v; sqlite4_num_to_int64(aIn[i].u.num, &v); n = aAux[i].n; aOut[nOut+(--n)] = v & 0xff; while( n ){ v >>= 8; aOut[nOut+(--n)] = v & 0xff; } nOut += aAux[i].n; |
︙ | ︙ | |||
521 522 523 524 525 526 527 | int n; int iStart = p->nOut; if( flags & MEM_Null ){ if( enlargeEncoderAllocation(p, 1) ) return SQLITE4_NOMEM; p->aOut[p->nOut++] = 0x05; /* NULL */ }else if( flags & MEM_Int ){ | | > | > | 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 | int n; int iStart = p->nOut; if( flags & MEM_Null ){ if( enlargeEncoderAllocation(p, 1) ) return SQLITE4_NOMEM; p->aOut[p->nOut++] = 0x05; /* NULL */ }else if( flags & MEM_Int ){ sqlite4_int64 v; sqlite4_num_to_int64(pMem->u.num, &v); if( enlargeEncoderAllocation(p, 11) ) return SQLITE4_NOMEM; if( v==0 ){ p->aOut[p->nOut++] = 0x15; /* Numeric zero */ }else if( v<0 ){ p->aOut[p->nOut++] = 0x08; /* Large negative number */ i = p->nOut; e = encodeIntKey((sqlite4_uint64)-v, p); if( e<=10 ) p->aOut[i-1] = 0x13-e; while( i<p->nOut ) p->aOut[i++] ^= 0xff; }else{ i = p->nOut; p->aOut[p->nOut++] = 0x22; /* Large positive number */ e = encodeIntKey((sqlite4_uint64)v, p); if( e<=10 ) p->aOut[i] = 0x17+e; } }else if( flags & MEM_Real ){ double r; sqlite4_num_to_double(pMem->u.num, &r); if( enlargeEncoderAllocation(p, 16) ) return SQLITE4_NOMEM; if( r==0.0 ){ p->aOut[p->nOut++] = 0x15; /* Numeric zero */ }else if( sqlite4IsNaN(r) ){ p->aOut[p->nOut++] = 0x06; /* NaN */ }else if( (n = sqlite4IsInf(r))!=0 ){ p->aOut[p->nOut++] = n<0 ? 0x07 : 0x23; /* Neg and Pos infinity */ |
︙ | ︙ |
Changes to src/vdbemem.c.
︙ | ︙ | |||
183 184 185 186 187 188 189 | /* For a Real or Integer, use sqlite4_mprintf() to produce the UTF-8 ** string representation of the value. Then, if the required encoding ** is UTF-16le or UTF-16be do a translation. ** ** FIX ME: It would be better if sqlite4_snprintf() could do UTF-16. */ | < | < < < < | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | /* For a Real or Integer, use sqlite4_mprintf() to produce the UTF-8 ** string representation of the value. Then, if the required encoding ** is UTF-16le or UTF-16be do a translation. ** ** FIX ME: It would be better if sqlite4_snprintf() could do UTF-16. */ sqlite4_num_to_text(pMem->u.num, pMem->z); pMem->n = sqlite4Strlen30(pMem->z); pMem->enc = SQLITE4_UTF8; pMem->flags |= MEM_Str|MEM_Term; sqlite4VdbeChangeEncoding(pMem, enc); return rc; } |
︙ | ︙ | |||
317 318 319 320 321 322 323 | ** If pMem represents a string value, its encoding might be changed. */ i64 sqlite4VdbeIntValue(Mem *pMem){ int flags; assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); flags = pMem->flags; | | > | < | | > > | < < > > > | > < | | | > | > | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | ** If pMem represents a string value, its encoding might be changed. */ i64 sqlite4VdbeIntValue(Mem *pMem){ int flags; assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); flags = pMem->flags; if( flags & (MEM_Int|MEM_Real) ){ i64 i1; sqlite4_num_to_int64(pMem->u.num, &i1); return i1; }else if( flags & (MEM_Str|MEM_Blob) ){ i64 value = 0; assert( pMem->z || pMem->n==0 ); testcase( pMem->z==0 ); sqlite4Atoi64(pMem->z, &value, pMem->n, pMem->enc); return value; }else{ return 0; } } /* ** Return the best representation of pMem that we can get into a ** double. If pMem is already a double or an integer, return its ** value. If it is a string or blob, try to convert it to a double. ** If it is a NULL, return 0.0. */ double sqlite4VdbeRealValue(Mem *pMem){ assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); if( pMem->flags & (MEM_Real|MEM_Int) ){ double r; sqlite4_num_to_double(pMem->u.num, &r); return r; }else if( pMem->flags & (MEM_Str|MEM_Blob) ){ /* (double)0 In case of SQLITE4_OMIT_FLOATING_POINT... */ double val = (double)0; sqlite4AtoF(pMem->z, &val, pMem->n, pMem->enc); return val; }else{ /* (double)0 In case of SQLITE4_OMIT_FLOATING_POINT... */ return (double)0; } } /* ** The MEM structure is already a MEM_Real. Try to also make it a ** MEM_Int if we can. */ void sqlite4VdbeIntegerAffinity(Mem *pMem){ i64 i; double r; assert( pMem->flags & MEM_Real ); assert( (pMem->flags & MEM_RowSet)==0 ); assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); sqlite4_num_to_int64(pMem->u.num, &i); sqlite4_num_to_double(pMem->u.num, &r); /* Only mark the value as an integer if ** ** (1) the round-trip conversion real->int->real is a no-op, and ** (2) The integer is neither the largest nor the smallest ** possible integer (ticket #3922) ** ** The second and third terms in the following conditional enforces ** the second condition under the assumption that addition overflow causes ** values to wrap around. On x86 hardware, the third term is always ** true and could be omitted. But we leave it in because other ** architectures might behave differently. */ if( r==(double)i && i>SMALLEST_INT64 && ALWAYS(i<LARGEST_INT64) ){ pMem->flags |= MEM_Int; } } /* ** Convert pMem to type integer. Invalidate any prior representations. */ int sqlite4VdbeMemIntegerify(Mem *pMem){ assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( (pMem->flags & MEM_RowSet)==0 ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); pMem->u.num = sqlite4_num_from_int64(sqlite4VdbeIntValue(pMem)); MemSetTypeFlag(pMem, MEM_Int); return SQLITE4_OK; } /* ** Convert pMem so that it is of type MEM_Real. ** Invalidate any prior representations. */ int sqlite4VdbeMemRealify(Mem *pMem){ assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); pMem->u.num = sqlite4_num_from_double(sqlite4VdbeRealValue(pMem)); MemSetTypeFlag(pMem, MEM_Real); return SQLITE4_OK; } /* ** Convert pMem so that it has types MEM_Real or MEM_Int or both. ** Invalidate any prior representations. ** ** Every effort is made to force the conversion, even if the input ** is a string that does not look completely like a number. Convert ** as much of the string as we can and ignore the rest. */ int sqlite4VdbeMemNumerify(Mem *pMem){ if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){ i64 i1; assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 ); assert( pMem->db==0 || sqlite4_mutex_held(pMem->db->mutex) ); if( 0==sqlite4Atoi64(pMem->z, &i1, pMem->n, pMem->enc) ){ pMem->u.num = sqlite4_num_from_int64(i1); MemSetTypeFlag(pMem, MEM_Int); }else{ pMem->u.num = sqlite4_num_from_double(sqlite4VdbeRealValue(pMem)); MemSetTypeFlag(pMem, MEM_Real); sqlite4VdbeIntegerAffinity(pMem); } } assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 ); pMem->flags &= ~(MEM_Str|MEM_Blob); return SQLITE4_OK; |
︙ | ︙ | |||
458 459 460 461 462 463 464 | /* ** Delete any previous value and set the value stored in *pMem to val, ** manifest type INTEGER. */ void sqlite4VdbeMemSetInt64(Mem *pMem, i64 val){ sqlite4VdbeMemRelease(pMem); | | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | /* ** Delete any previous value and set the value stored in *pMem to val, ** manifest type INTEGER. */ void sqlite4VdbeMemSetInt64(Mem *pMem, i64 val){ sqlite4VdbeMemRelease(pMem); pMem->u.num = sqlite4_num_from_int64(val); pMem->flags = MEM_Int; pMem->type = SQLITE4_INTEGER; } #ifndef SQLITE4_OMIT_FLOATING_POINT /* ** Delete any previous value and set the value stored in *pMem to val, ** manifest type REAL. */ void sqlite4VdbeMemSetDouble(Mem *pMem, double val){ if( sqlite4IsNaN(val) ){ sqlite4VdbeMemSetNull(pMem); }else{ sqlite4VdbeMemRelease(pMem); pMem->u.num = sqlite4_num_from_double(val); pMem->flags = MEM_Real; pMem->type = SQLITE4_FLOAT; } } #endif /* |
︙ | ︙ | |||
734 735 736 737 738 739 740 | return 1; } if( !(f2&(MEM_Int|MEM_Real)) ){ return -1; } if( (f1 & f2 & MEM_Int)==0 ){ double r1, r2; | < | < < < < | < < < > > > | | | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | return 1; } if( !(f2&(MEM_Int|MEM_Real)) ){ return -1; } if( (f1 & f2 & MEM_Int)==0 ){ double r1, r2; sqlite4_num_to_double(pMem1->u.num, &r1); sqlite4_num_to_double(pMem2->u.num, &r2); if( r1<r2 ) return -1; if( r1>r2 ) return 1; return 0; }else{ i64 i1, i2; sqlite4_num_to_int64(pMem1->u.num, &i1); sqlite4_num_to_int64(pMem2->u.num, &i2); assert( f1&MEM_Int ); assert( f2&MEM_Int ); if( i1<i2 ) return -1; if( i1>i2 ) return 1; return 0; } } /* If one value is a string and the other is a blob, the string is less. ** If both are strings, compare using the collating functions. */ |
︙ | ︙ | |||
945 946 947 948 949 950 951 | if( enc!=SQLITE4_UTF8 ){ sqlite4VdbeChangeEncoding(pVal, enc); } }else if( op==TK_UMINUS ) { /* This branch happens for multiple negative signs. Ex: -(-5) */ if( SQLITE4_OK==sqlite4ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){ sqlite4VdbeMemNumerify(pVal); | < < < < < | < < | 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | if( enc!=SQLITE4_UTF8 ){ sqlite4VdbeChangeEncoding(pVal, enc); } }else if( op==TK_UMINUS ) { /* This branch happens for multiple negative signs. Ex: -(-5) */ if( SQLITE4_OK==sqlite4ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){ sqlite4VdbeMemNumerify(pVal); pVal->u.num = sqlite4_num_mul(pVal->u.num, sqlite4_num_from_int64(-1)); sqlite4ValueApplyAffinity(pVal, affinity, enc); } }else if( op==TK_NULL ){ pVal = sqlite4ValueNew(db); if( pVal==0 ) goto no_mem; } #ifndef SQLITE4_OMIT_BLOB_LITERAL |
︙ | ︙ |
Changes to src/vdbetrace.c.
︙ | ︙ | |||
115 116 117 118 119 120 121 | } zRawSql += nToken; nextIndex = idx + 1; assert( idx>0 && idx<=p->nVar ); pVar = &p->aVar[idx-1]; if( pVar->flags & MEM_Null ){ sqlite4StrAccumAppend(&out, "NULL", 4); | | | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | } zRawSql += nToken; nextIndex = idx + 1; assert( idx>0 && idx<=p->nVar ); pVar = &p->aVar[idx-1]; if( pVar->flags & MEM_Null ){ sqlite4StrAccumAppend(&out, "NULL", 4); }else if( pVar->flags & (MEM_Int|MEM_Real) ){ char aOut[30]; sqlite4_num_to_text(pVar->u.num, aOut); sqlite4XPrintf(&out, "%s", aOut); }else if( pVar->flags & MEM_Str ){ #ifndef SQLITE4_OMIT_UTF16 u8 enc = ENC(db); if( enc!=SQLITE4_UTF8 ){ Mem utf8; memset(&utf8, 0, sizeof(utf8)); utf8.db = db; |
︙ | ︙ |
Changes to test/num.test.
︙ | ︙ | |||
84 85 86 87 88 89 90 91 | } {equal} do_test num-6.1.3 { sqlite4_num_to_text [sqlite4_num_div 2 1] } {2} do_test num-6.1.4 { sqlite4_num_to_text [sqlite4_num_div 22 10] } {2.2} finish_test | > > > > > > > > > > > > > > > > > > > > > > > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | } {equal} do_test num-6.1.3 { sqlite4_num_to_text [sqlite4_num_div 2 1] } {2} do_test num-6.1.4 { sqlite4_num_to_text [sqlite4_num_div 22 10] } {2.2} #------------------------------------------------------------------------- # The following test cases - num-7.* - test the sqlite4_num_from_double() # API function. foreach {tn in out} { 1 1.0 {sign:0 e:0 m:1} 2 -1.0 {sign:1 e:0 m:1} 3 1.5 {sign:0 e:-1 m:15} 4 -1.5 {sign:1 e:-1 m:15} 5 0.15 {sign:0 e:-2 m:15} 6 -0.15 {sign:1 e:-2 m:15} 7 45.345687 {sign:0 e:-6 m:45345687} 8 1000000000000000000 {sign:0 e:18 m:1} } { do_test num-7.1.$tn { set res [sqlite4_num_from_double $in] list [lindex $res 0] [lindex $res 2] [lindex $res 3] } [list [lindex $out 0] [lindex $out 1] [lindex $out 2]] } finish_test |
Changes to test/select1.test.
︙ | ︙ | |||
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | # ORDER BY expressions # do_test select1-4.1 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY f1}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.2 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY -f1}} msg] lappend v $msg } {0 {33 11}} do_test select1-4.3 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1,f2)}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.4 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg] lappend v $msg | > > | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | # ORDER BY expressions # do_test select1-4.1 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY f1}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.2 { execsql { PRAGMA vdbe_trace = 1; } set v [catch {execsql {SELECT f1 FROM test1 ORDER BY -f1}} msg] lappend v $msg } {0 {33 11}} exit do_test select1-4.3 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1,f2)}} msg] lappend v $msg } {0 {11 33}} do_test select1-4.4 { set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg] lappend v $msg |
︙ | ︙ |
Changes to test/testInt.h.
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 | #define TESTMEM_CTRL_REPORT 62930001 #define TESTMEM_CTRL_FAULTCONFIG 62930002 #define TESTMEM_CTRL_FAULTREPORT 62930003 sqlite4_mm *test_mm_debug(sqlite4_mm *p); sqlite4_mm *test_mm_faultsim(sqlite4_mm *p); #endif | > > > | 62 63 64 65 66 67 68 69 70 71 72 73 | #define TESTMEM_CTRL_REPORT 62930001 #define TESTMEM_CTRL_FAULTCONFIG 62930002 #define TESTMEM_CTRL_FAULTREPORT 62930003 sqlite4_mm *test_mm_debug(sqlite4_mm *p); sqlite4_mm *test_mm_faultsim(sqlite4_mm *p); /* test_num.c */ int Sqlitetest_num_init(Tcl_Interp *interp); #endif |
Changes to test/test_main.c.
︙ | ︙ | |||
4136 4137 4138 4139 4140 4141 4142 | } return TCL_ERROR; } sqlite4_test_control(SQLITE4_TESTCTRL_OPTIMIZATIONS, db, mask); return TCL_OK; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 | } return TCL_ERROR; } sqlite4_test_control(SQLITE4_TESTCTRL_OPTIMIZATIONS, db, mask); return TCL_OK; } void sqlite4TestInit(Tcl_Interp *interp){ Sqlitetest_auth_init(interp); Sqlitetest_num_init(interp); } /* ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite4_search_count; |
︙ | ︙ | |||
4391 4392 4393 4394 4395 4396 4397 | { "sqlite4_interrupt", (Tcl_CmdProc*)test_interrupt }, { "sqlite_delete_function", (Tcl_CmdProc*)delete_function }, { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite4_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite4_stack_used", (Tcl_CmdProc*)test_stack_used }, { "printf", (Tcl_CmdProc*)test_printf }, { "sqlite4IoTrace", (Tcl_CmdProc*)test_io_trace }, | < < < < < < < < < | 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 | { "sqlite4_interrupt", (Tcl_CmdProc*)test_interrupt }, { "sqlite_delete_function", (Tcl_CmdProc*)delete_function }, { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite4_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite4_stack_used", (Tcl_CmdProc*)test_stack_used }, { "printf", (Tcl_CmdProc*)test_printf }, { "sqlite4IoTrace", (Tcl_CmdProc*)test_io_trace }, }; static struct { char *zName; Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { { "sqlite4_connection_pointer", get_sqlite_pointer, 0 }, |
︙ | ︙ |