Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Comment out unused code when SQLITE_OMIT_FLOATING_POINT is selected. Added testcase() macros to boundary conditions in util.c routines. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dfc6595d347ea87923a857778b687511 |
User & Date: | drh 2010-01-13 04:22:21.000 |
Context
2010-01-13
| ||
14:08 | Add tests to backup.test to verify that SQLite behaves as expected when the source database is modified mid-backup. (check-in: 985d3bec07 user: dan tags: trunk) | |
04:22 | Comment out unused code when SQLITE_OMIT_FLOATING_POINT is selected. Added testcase() macros to boundary conditions in util.c routines. (check-in: dfc6595d34 user: drh tags: trunk) | |
00:04 | Make the sqlite3_result_double() interface work the same as sqlite3_result_int64() when SQLITE_OMIT_FLOATING_POINT is defined. (check-in: 61df598660 user: drh tags: trunk) | |
Changes
Changes to src/expr.c.
︙ | ︙ | |||
2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 | sqlite3VdbeAddOp2(v, OP_Param, p1, target); VdbeComment((v, "%s.%s -> $%d", (pExpr->iTable ? "new" : "old"), (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName), target )); /* If the column has REAL affinity, it may currently be stored as an ** integer. Use OP_RealAffinity to make sure it is really real. */ if( pExpr->iColumn>=0 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL ){ sqlite3VdbeAddOp1(v, OP_RealAffinity, target); } break; } /* ** Form A: ** CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END | > > | 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 | sqlite3VdbeAddOp2(v, OP_Param, p1, target); VdbeComment((v, "%s.%s -> $%d", (pExpr->iTable ? "new" : "old"), (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName), target )); #ifndef SQLITE_OMIT_FLOATING_POINT /* If the column has REAL affinity, it may currently be stored as an ** integer. Use OP_RealAffinity to make sure it is really real. */ if( pExpr->iColumn>=0 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL ){ sqlite3VdbeAddOp1(v, OP_RealAffinity, target); } #endif break; } /* ** Form A: ** CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END |
︙ | ︙ |
Changes to src/util.c.
︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | if( *z=='-' || *z=='+' ) z += incr; if( !sqlite3Isdigit(*z) ){ return 0; } z += incr; *realnum = 0; while( sqlite3Isdigit(*z) ){ z += incr; } if( *z=='.' ){ z += incr; if( !sqlite3Isdigit(*z) ) return 0; while( sqlite3Isdigit(*z) ){ z += incr; } *realnum = 1; } if( *z=='e' || *z=='E' ){ z += incr; if( *z=='+' || *z=='-' ) z += incr; if( !sqlite3Isdigit(*z) ) return 0; while( sqlite3Isdigit(*z) ){ z += incr; } *realnum = 1; } return *z==0; } /* ** The string z[] is an ASCII representation of a real number. ** Convert this string to a double. ** | > > | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | if( *z=='-' || *z=='+' ) z += incr; if( !sqlite3Isdigit(*z) ){ return 0; } z += incr; *realnum = 0; while( sqlite3Isdigit(*z) ){ z += incr; } #ifndef SQLITE_OMIT_FLOATING_POINT if( *z=='.' ){ z += incr; if( !sqlite3Isdigit(*z) ) return 0; while( sqlite3Isdigit(*z) ){ z += incr; } *realnum = 1; } if( *z=='e' || *z=='E' ){ z += incr; if( *z=='+' || *z=='-' ) z += incr; if( !sqlite3Isdigit(*z) ) return 0; while( sqlite3Isdigit(*z) ){ z += incr; } *realnum = 1; } #endif return *z==0; } /* ** The string z[] is an ASCII representation of a real number. ** Convert this string to a double. ** |
︙ | ︙ | |||
425 426 427 428 429 430 431 432 433 434 435 436 437 438 | ** will return -8. */ static int compare2pow63(const char *zNum){ int c; c = memcmp(zNum,"922337203685477580",18)*10; if( c==0 ){ c = zNum[18] - '8'; } return c; } /* ** Return TRUE if zNum is a 64-bit signed integer and write | > > > | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | ** will return -8. */ static int compare2pow63(const char *zNum){ int c; c = memcmp(zNum,"922337203685477580",18)*10; if( c==0 ){ c = zNum[18] - '8'; testcase( c==(-1) ); testcase( c==0 ); testcase( c==(+1) ); } return c; } /* ** Return TRUE if zNum is a 64-bit signed integer and write |
︙ | ︙ | |||
461 462 463 464 465 466 467 468 469 470 471 472 473 474 | } zStart = zNum; while( zNum[0]=='0' ){ zNum++; } /* Skip over leading zeros. Ticket #2454 */ for(i=0; (c=zNum[i])>='0' && c<='9'; i++){ v = v*10 + c - '0'; } *pNum = neg ? -v : v; if( c!=0 || (i==0 && zStart==zNum) || i>19 ){ /* zNum is empty or contains non-numeric text or is longer ** than 19 digits (thus guaranting that it is too large) */ return 0; }else if( i<19 ){ /* Less than 19 digits, so we know that it fits in 64 bits */ return 1; | > > > | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | } zStart = zNum; while( zNum[0]=='0' ){ zNum++; } /* Skip over leading zeros. Ticket #2454 */ for(i=0; (c=zNum[i])>='0' && c<='9'; i++){ v = v*10 + c - '0'; } *pNum = neg ? -v : v; testcase( i==18 ); testcase( i==19 ); testcase( i==20 ); if( c!=0 || (i==0 && zStart==zNum) || i>19 ){ /* zNum is empty or contains non-numeric text or is longer ** than 19 digits (thus guaranting that it is too large) */ return 0; }else if( i<19 ){ /* Less than 19 digits, so we know that it fits in 64 bits */ return 1; |
︙ | ︙ | |||
504 505 506 507 508 509 510 511 512 513 514 515 516 517 | assert( zNum[0]>='0' && zNum[0]<='9' ); /* zNum is an unsigned number */ if( negFlag ) neg = 1-neg; while( *zNum=='0' ){ zNum++; /* Skip leading zeros. Ticket #2454 */ } for(i=0; zNum[i]; i++){ assert( zNum[i]>='0' && zNum[i]<='9' ); } if( i<19 ){ /* Guaranteed to fit if less than 19 digits */ return 1; }else if( i>19 ){ /* Guaranteed to be too big if greater than 19 digits */ return 0; }else{ | > > > | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | assert( zNum[0]>='0' && zNum[0]<='9' ); /* zNum is an unsigned number */ if( negFlag ) neg = 1-neg; while( *zNum=='0' ){ zNum++; /* Skip leading zeros. Ticket #2454 */ } for(i=0; zNum[i]; i++){ assert( zNum[i]>='0' && zNum[i]<='9' ); } testcase( i==18 ); testcase( i==19 ); testcase( i==20 ); if( i<19 ){ /* Guaranteed to fit if less than 19 digits */ return 1; }else if( i>19 ){ /* Guaranteed to be too big if greater than 19 digits */ return 0; }else{ |
︙ | ︙ | |||
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | } /* The longest decimal representation of a 32 bit integer is 10 digits: ** ** 1234567890 ** 2^31 -> 2147483648 */ if( i>10 ){ return 0; } if( v-neg>2147483647 ){ return 0; } if( neg ){ v = -v; } *pValue = (int)v; | > > | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | } /* The longest decimal representation of a 32 bit integer is 10 digits: ** ** 1234567890 ** 2^31 -> 2147483648 */ testcase( i==10 ); if( i>10 ){ return 0; } testcase( v-neg==2147483647 ); if( v-neg>2147483647 ){ return 0; } if( neg ){ v = -v; } *pValue = (int)v; |
︙ | ︙ |