Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Update the built-in SQLite and Pikchr to the latest code, for testing. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
ecf679b28956ccb39787f9915e7446b3 |
| User & Date: | drh 2020-09-16 13:45:12.260 |
Context
|
2020-09-16
| ||
| 13:58 | Fix problems with the built-in "decompress()" SQL function. check-in: 449ab5d600 user: drh tags: trunk | |
| 13:45 | Update the built-in SQLite and Pikchr to the latest code, for testing. check-in: ecf679b289 user: drh tags: trunk | |
| 13:21 | Make an appropriate entry in the rcvfrom table when doing a git or svn import. See [forum:92db82a45e|forum post 92db82a45e] for details on the problem that this check-in attempts to fix. check-in: 59ba20f845 user: drh tags: trunk | |
Changes
Changes to src/pikchr.c.
| ︙ | ︙ | |||
273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
#define A_DASHED 0x0010 /* Includes "dotted" */
#define A_FILL 0x0020
#define A_COLOR 0x0040
#define A_ARROW 0x0080
#define A_FROM 0x0100
#define A_CW 0x0200
#define A_AT 0x0400
/* A single element */
struct PElem {
const PClass *type; /* Element type */
PToken errTok; /* Reference token for error messages */
PPoint ptAt; /* Reference point for the object */
| > | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
#define A_DASHED 0x0010 /* Includes "dotted" */
#define A_FILL 0x0020
#define A_COLOR 0x0040
#define A_ARROW 0x0080
#define A_FROM 0x0100
#define A_CW 0x0200
#define A_AT 0x0400
#define A_TO 0x0800 /* one or more movement attributes */
/* A single element */
struct PElem {
const PClass *type; /* Element type */
PToken errTok; /* Reference token for error messages */
PPoint ptAt; /* Reference point for the object */
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 |
/* Cache of layout values. <=0.0 for unknown... */
PNum rScale; /* Multiply to convert inches to pixels */
PNum fontScale; /* Scale fonts by this percent */
PNum charWidth; /* Character width */
PNum charHeight; /* Character height */
PNum wArrow; /* Width of arrowhead at the fat end */
PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
| | > | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
/* Cache of layout values. <=0.0 for unknown... */
PNum rScale; /* Multiply to convert inches to pixels */
PNum fontScale; /* Scale fonts by this percent */
PNum charWidth; /* Character width */
PNum charHeight; /* Character height */
PNum wArrow; /* Width of arrowhead at the fat end */
PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
char bLayoutVars; /* True if cache is valid */
char thenFlag; /* True if "then" seen */
char samePath; /* aTPath copied by "same" */
const char *zClass; /* Class name for the <svg> */
int wSVG, hSVG; /* Width and height of the <svg> */
/* Paths for lines are constructed here first, then transferred into
** the PElem object at the end: */
int nTPath; /* Number of entries on aTPath[] */
int mTPath; /* For last entry, 1: x set, 2: y set */
PPoint aTPath[1000]; /* Path under construction */
|
| ︙ | ︙ | |||
448 449 450 451 452 453 454 | static PToken pik_next_semantic_token(Pik *p, PToken *pThis); static void pik_compute_layout_settings(Pik*); static void pik_behind(Pik*,PElem*); static PElem *pik_assert(Pik*,PNum,PToken*,PNum); static PElem *pik_place_assert(Pik*,PPoint*,PToken*,PPoint*); | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | static PToken pik_next_semantic_token(Pik *p, PToken *pThis); static void pik_compute_layout_settings(Pik*); static void pik_behind(Pik*,PElem*); static PElem *pik_assert(Pik*,PNum,PToken*,PNum); static PElem *pik_place_assert(Pik*,PPoint*,PToken*,PPoint*); #line 483 "pikchr.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef T_ID #define T_ID 1 #define T_EDGEPT 2 #define T_OF 3 |
| ︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 94: /* element_list */
{
| | | | | | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 94: /* element_list */
{
#line 472 "pikchr.y"
pik_elist_free(p,(yypminor->yy72));
#line 1660 "pikchr.c"
}
break;
case 95: /* element */
case 96: /* unnamed_element */
case 97: /* basetype */
{
#line 474 "pikchr.y"
pik_elem_free(p,(yypminor->yy254));
#line 1669 "pikchr.c"
}
break;
/********* End destructor definitions *****************************************/
default: break; /* If no destructor action specified: do nothing */
}
}
|
| ︙ | ︙ | |||
1853 1854 1855 1856 1857 1858 1859 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
| | | | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
#line 505 "pikchr.y"
pik_error(p, 0, "parser stack overflow");
#line 1890 "pikchr.c"
/******** End %stack_overflow code ********************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
pik_parserCTX_STORE
}
/*
** Print tracing information for a SHIFT action
|
| ︙ | ︙ | |||
2325 2326 2327 2328 2329 2330 2331 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= element_list */
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= element_list */
#line 509 "pikchr.y"
{pik_render(p,yymsp[0].minor.yy72);}
#line 2361 "pikchr.c"
break;
case 1: /* element_list ::= element */
#line 512 "pikchr.y"
{ yylhsminor.yy72 = pik_elist_append(p,0,yymsp[0].minor.yy254); }
#line 2366 "pikchr.c"
yymsp[0].minor.yy72 = yylhsminor.yy72;
break;
case 2: /* element_list ::= element_list EOL element */
#line 514 "pikchr.y"
{ yylhsminor.yy72 = pik_elist_append(p,yymsp[-2].minor.yy72,yymsp[0].minor.yy254); }
#line 2372 "pikchr.c"
yymsp[-2].minor.yy72 = yylhsminor.yy72;
break;
case 3: /* element ::= */
#line 517 "pikchr.y"
{ yymsp[1].minor.yy254 = 0; }
#line 2378 "pikchr.c"
break;
case 4: /* element ::= direction */
#line 518 "pikchr.y"
{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy254=0; }
#line 2383 "pikchr.c"
yymsp[0].minor.yy254 = yylhsminor.yy254;
break;
case 5: /* element ::= lvalue ASSIGN rvalue */
#line 519 "pikchr.y"
{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy73,&yymsp[-1].minor.yy0); yylhsminor.yy254=0;}
#line 2389 "pikchr.c"
yymsp[-2].minor.yy254 = yylhsminor.yy254;
break;
case 6: /* element ::= PLACENAME COLON unnamed_element */
#line 521 "pikchr.y"
{ yylhsminor.yy254 = yymsp[0].minor.yy254; pik_elem_setname(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0); }
#line 2395 "pikchr.c"
yymsp[-2].minor.yy254 = yylhsminor.yy254;
break;
case 7: /* element ::= PLACENAME COLON position */
#line 523 "pikchr.y"
{ yylhsminor.yy254 = pik_elem_new(p,0,0,0);
if(yylhsminor.yy254){ yylhsminor.yy254->ptAt = yymsp[0].minor.yy139; pik_elem_setname(p,yylhsminor.yy254,&yymsp[-2].minor.yy0); }}
#line 2402 "pikchr.c"
yymsp[-2].minor.yy254 = yylhsminor.yy254;
break;
case 8: /* element ::= unnamed_element */
#line 525 "pikchr.y"
{yylhsminor.yy254 = yymsp[0].minor.yy254;}
#line 2408 "pikchr.c"
yymsp[0].minor.yy254 = yylhsminor.yy254;
break;
case 9: /* element ::= print prlist */
#line 526 "pikchr.y"
{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy254=0;}
#line 2414 "pikchr.c"
break;
case 10: /* element ::= ASSERT LP expr EQ expr RP */
#line 531 "pikchr.y"
{yymsp[-5].minor.yy254=pik_assert(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy73);}
#line 2419 "pikchr.c"
break;
case 11: /* element ::= ASSERT LP place EQ place RP */
#line 533 "pikchr.y"
{yymsp[-5].minor.yy254=pik_place_assert(p,&yymsp[-3].minor.yy139,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy139);}
#line 2424 "pikchr.c"
break;
case 12: /* rvalue ::= PLACENAME */
#line 544 "pikchr.y"
{yylhsminor.yy73 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
#line 2429 "pikchr.c"
yymsp[0].minor.yy73 = yylhsminor.yy73;
break;
case 13: /* pritem ::= FILL */
case 14: /* pritem ::= COLOR */ yytestcase(yyruleno==14);
case 15: /* pritem ::= THICKNESS */ yytestcase(yyruleno==15);
#line 549 "pikchr.y"
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
#line 2437 "pikchr.c"
break;
case 16: /* pritem ::= rvalue */
#line 552 "pikchr.y"
{pik_append_num(p,"",yymsp[0].minor.yy73);}
#line 2442 "pikchr.c"
break;
case 17: /* pritem ::= STRING */
#line 553 "pikchr.y"
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
#line 2447 "pikchr.c"
break;
case 18: /* prsep ::= COMMA */
#line 554 "pikchr.y"
{pik_append(p, " ", 1);}
#line 2452 "pikchr.c"
break;
case 19: /* unnamed_element ::= basetype attribute_list */
#line 557 "pikchr.y"
{yylhsminor.yy254 = yymsp[-1].minor.yy254; pik_after_adding_attributes(p,yylhsminor.yy254);}
#line 2457 "pikchr.c"
yymsp[-1].minor.yy254 = yylhsminor.yy254;
break;
case 20: /* basetype ::= CLASSNAME */
#line 559 "pikchr.y"
{yylhsminor.yy254 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
#line 2463 "pikchr.c"
yymsp[0].minor.yy254 = yylhsminor.yy254;
break;
case 21: /* basetype ::= STRING textposition */
#line 561 "pikchr.y"
{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy74; yylhsminor.yy254 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
#line 2469 "pikchr.c"
yymsp[-1].minor.yy254 = yylhsminor.yy254;
break;
case 22: /* basetype ::= LB savelist element_list RB */
#line 563 "pikchr.y"
{ p->list = yymsp[-2].minor.yy72; yymsp[-3].minor.yy254 = pik_elem_new(p,0,0,yymsp[-1].minor.yy72); if(yymsp[-3].minor.yy254) yymsp[-3].minor.yy254->errTok = yymsp[0].minor.yy0; }
#line 2475 "pikchr.c"
break;
case 23: /* savelist ::= */
#line 568 "pikchr.y"
{yymsp[1].minor.yy72 = p->list; p->list = 0;}
#line 2480 "pikchr.c"
break;
case 24: /* relexpr ::= expr */
#line 575 "pikchr.y"
{yylhsminor.yy60.rAbs = yymsp[0].minor.yy73; yylhsminor.yy60.rRel = 0;}
#line 2485 "pikchr.c"
yymsp[0].minor.yy60 = yylhsminor.yy60;
break;
case 25: /* relexpr ::= expr PERCENT */
#line 576 "pikchr.y"
{yylhsminor.yy60.rAbs = 0; yylhsminor.yy60.rRel = yymsp[-1].minor.yy73/100;}
#line 2491 "pikchr.c"
yymsp[-1].minor.yy60 = yylhsminor.yy60;
break;
case 26: /* optrelexpr ::= */
#line 578 "pikchr.y"
{yymsp[1].minor.yy60.rAbs = 0; yymsp[1].minor.yy60.rRel = 1.0;}
#line 2497 "pikchr.c"
break;
case 27: /* attribute_list ::= relexpr alist */
#line 580 "pikchr.y"
{pik_add_direction(p,0,&yymsp[-1].minor.yy60);}
#line 2502 "pikchr.c"
break;
case 28: /* attribute ::= numproperty relexpr */
#line 584 "pikchr.y"
{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60); }
#line 2507 "pikchr.c"
break;
case 29: /* attribute ::= dashproperty expr */
#line 585 "pikchr.y"
{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy73); }
#line 2512 "pikchr.c"
break;
case 30: /* attribute ::= dashproperty */
#line 586 "pikchr.y"
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
#line 2517 "pikchr.c"
break;
case 31: /* attribute ::= colorproperty rvalue */
#line 587 "pikchr.y"
{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73); }
#line 2522 "pikchr.c"
break;
case 32: /* attribute ::= go direction optrelexpr */
#line 588 "pikchr.y"
{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60);}
#line 2527 "pikchr.c"
break;
case 33: /* attribute ::= go direction even position */
#line 589 "pikchr.y"
{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139);}
#line 2532 "pikchr.c"
break;
case 34: /* attribute ::= CLOSE */
#line 590 "pikchr.y"
{ pik_close_path(p,&yymsp[0].minor.yy0); }
#line 2537 "pikchr.c"
break;
case 35: /* attribute ::= CHOP */
#line 591 "pikchr.y"
{ p->cur->bChop = 1; }
#line 2542 "pikchr.c"
break;
case 36: /* attribute ::= FROM position */
#line 592 "pikchr.y"
{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
#line 2547 "pikchr.c"
break;
case 37: /* attribute ::= TO position */
#line 593 "pikchr.y"
{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
#line 2552 "pikchr.c"
break;
case 38: /* attribute ::= THEN */
#line 594 "pikchr.y"
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
#line 2557 "pikchr.c"
break;
case 39: /* attribute ::= THEN optrelexpr HEADING expr */
case 41: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==41);
#line 596 "pikchr.y"
{pik_move_hdg(p,&yymsp[-2].minor.yy60,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73,0,&yymsp[-3].minor.yy0);}
#line 2563 "pikchr.c"
break;
case 40: /* attribute ::= THEN optrelexpr EDGEPT */
case 42: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==42);
#line 597 "pikchr.y"
{pik_move_hdg(p,&yymsp[-1].minor.yy60,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
#line 2569 "pikchr.c"
break;
case 43: /* attribute ::= AT position */
#line 602 "pikchr.y"
{ pik_set_at(p,0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
#line 2574 "pikchr.c"
break;
case 44: /* attribute ::= SAME */
#line 604 "pikchr.y"
{pik_same(p,0,&yymsp[0].minor.yy0);}
#line 2579 "pikchr.c"
break;
case 45: /* attribute ::= SAME AS object */
#line 605 "pikchr.y"
{pik_same(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
#line 2584 "pikchr.c"
break;
case 46: /* attribute ::= STRING textposition */
#line 606 "pikchr.y"
{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy74);}
#line 2589 "pikchr.c"
break;
case 47: /* attribute ::= FIT */
#line 607 "pikchr.y"
{pik_size_to_fit(p,&yymsp[0].minor.yy0); }
#line 2594 "pikchr.c"
break;
case 48: /* attribute ::= BEHIND object */
#line 608 "pikchr.y"
{pik_behind(p,yymsp[0].minor.yy254);}
#line 2599 "pikchr.c"
break;
case 49: /* withclause ::= DOT_E edge AT position */
case 50: /* withclause ::= edge AT position */ yytestcase(yyruleno==50);
#line 616 "pikchr.y"
{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
#line 2605 "pikchr.c"
break;
case 51: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
#line 620 "pikchr.y"
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
#line 2610 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 52: /* boolproperty ::= CW */
#line 631 "pikchr.y"
{p->cur->cw = 1;}
#line 2616 "pikchr.c"
break;
case 53: /* boolproperty ::= CCW */
#line 632 "pikchr.y"
{p->cur->cw = 0;}
#line 2621 "pikchr.c"
break;
case 54: /* boolproperty ::= LARROW */
#line 633 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=0; }
#line 2626 "pikchr.c"
break;
case 55: /* boolproperty ::= RARROW */
#line 634 "pikchr.y"
{p->cur->larrow=0; p->cur->rarrow=1; }
#line 2631 "pikchr.c"
break;
case 56: /* boolproperty ::= LRARROW */
#line 635 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=1; }
#line 2636 "pikchr.c"
break;
case 57: /* boolproperty ::= INVIS */
#line 636 "pikchr.y"
{p->cur->sw = 0.0;}
#line 2641 "pikchr.c"
break;
case 58: /* boolproperty ::= THICK */
#line 637 "pikchr.y"
{p->cur->sw *= 1.5;}
#line 2646 "pikchr.c"
break;
case 59: /* boolproperty ::= THIN */
#line 638 "pikchr.y"
{p->cur->sw *= 0.67;}
#line 2651 "pikchr.c"
break;
case 60: /* textposition ::= */
#line 640 "pikchr.y"
{yymsp[1].minor.yy74 = 0;}
#line 2656 "pikchr.c"
break;
case 61: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
#line 643 "pikchr.y"
{yylhsminor.yy74 = pik_text_position(p,yymsp[-1].minor.yy74,&yymsp[0].minor.yy0);}
#line 2661 "pikchr.c"
yymsp[-1].minor.yy74 = yylhsminor.yy74;
break;
case 62: /* position ::= expr COMMA expr */
#line 646 "pikchr.y"
{yylhsminor.yy139.x=yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[0].minor.yy73;}
#line 2667 "pikchr.c"
yymsp[-2].minor.yy139 = yylhsminor.yy139;
break;
case 63: /* position ::= place PLUS expr COMMA expr */
#line 648 "pikchr.y"
{yylhsminor.yy139.x=yymsp[-4].minor.yy139.x+yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y+yymsp[0].minor.yy73;}
#line 2673 "pikchr.c"
yymsp[-4].minor.yy139 = yylhsminor.yy139;
break;
case 64: /* position ::= place MINUS expr COMMA expr */
#line 649 "pikchr.y"
{yylhsminor.yy139.x=yymsp[-4].minor.yy139.x-yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y-yymsp[0].minor.yy73;}
#line 2679 "pikchr.c"
yymsp[-4].minor.yy139 = yylhsminor.yy139;
break;
case 65: /* position ::= place PLUS LP expr COMMA expr RP */
#line 651 "pikchr.y"
{yylhsminor.yy139.x=yymsp[-6].minor.yy139.x+yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y+yymsp[-1].minor.yy73;}
#line 2685 "pikchr.c"
yymsp[-6].minor.yy139 = yylhsminor.yy139;
break;
case 66: /* position ::= place MINUS LP expr COMMA expr RP */
#line 653 "pikchr.y"
{yylhsminor.yy139.x=yymsp[-6].minor.yy139.x-yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y-yymsp[-1].minor.yy73;}
#line 2691 "pikchr.c"
yymsp[-6].minor.yy139 = yylhsminor.yy139;
break;
case 67: /* position ::= LP position COMMA position RP */
#line 654 "pikchr.y"
{yymsp[-4].minor.yy139.x=yymsp[-3].minor.yy139.x; yymsp[-4].minor.yy139.y=yymsp[-1].minor.yy139.y;}
#line 2697 "pikchr.c"
break;
case 68: /* position ::= LP position RP */
#line 655 "pikchr.y"
{yymsp[-2].minor.yy139=yymsp[-1].minor.yy139;}
#line 2702 "pikchr.c"
break;
case 69: /* position ::= expr between position AND position */
#line 657 "pikchr.y"
{yylhsminor.yy139 = pik_position_between(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy139,yymsp[0].minor.yy139);}
#line 2707 "pikchr.c"
yymsp[-4].minor.yy139 = yylhsminor.yy139;
break;
case 70: /* position ::= expr LT position COMMA position GT */
#line 659 "pikchr.y"
{yylhsminor.yy139 = pik_position_between(p,yymsp[-5].minor.yy73,yymsp[-3].minor.yy139,yymsp[-1].minor.yy139);}
#line 2713 "pikchr.c"
yymsp[-5].minor.yy139 = yylhsminor.yy139;
break;
case 71: /* position ::= expr ABOVE position */
#line 660 "pikchr.y"
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y += yymsp[-2].minor.yy73;}
#line 2719 "pikchr.c"
yymsp[-2].minor.yy139 = yylhsminor.yy139;
break;
case 72: /* position ::= expr BELOW position */
#line 661 "pikchr.y"
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y -= yymsp[-2].minor.yy73;}
#line 2725 "pikchr.c"
yymsp[-2].minor.yy139 = yylhsminor.yy139;
break;
case 73: /* position ::= expr LEFT OF position */
#line 662 "pikchr.y"
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x -= yymsp[-3].minor.yy73;}
#line 2731 "pikchr.c"
yymsp[-3].minor.yy139 = yylhsminor.yy139;
break;
case 74: /* position ::= expr RIGHT OF position */
#line 663 "pikchr.y"
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x += yymsp[-3].minor.yy73;}
#line 2737 "pikchr.c"
yymsp[-3].minor.yy139 = yylhsminor.yy139;
break;
case 75: /* position ::= expr ON HEADING EDGEPT OF position */
#line 665 "pikchr.y"
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-5].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
#line 2743 "pikchr.c"
yymsp[-5].minor.yy139 = yylhsminor.yy139;
break;
case 76: /* position ::= expr HEADING EDGEPT OF position */
#line 667 "pikchr.y"
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-4].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
#line 2749 "pikchr.c"
yymsp[-4].minor.yy139 = yylhsminor.yy139;
break;
case 77: /* position ::= expr EDGEPT OF position */
#line 669 "pikchr.y"
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
#line 2755 "pikchr.c"
yymsp[-3].minor.yy139 = yylhsminor.yy139;
break;
case 78: /* position ::= expr ON HEADING expr FROM position */
#line 671 "pikchr.y"
{yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-5].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
#line 2761 "pikchr.c"
yymsp[-5].minor.yy139 = yylhsminor.yy139;
break;
case 79: /* position ::= expr HEADING expr FROM position */
#line 673 "pikchr.y"
{yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
#line 2767 "pikchr.c"
yymsp[-4].minor.yy139 = yylhsminor.yy139;
break;
case 80: /* place ::= edge OF object */
#line 685 "pikchr.y"
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
#line 2773 "pikchr.c"
yymsp[-2].minor.yy139 = yylhsminor.yy139;
break;
case 81: /* place2 ::= object */
#line 686 "pikchr.y"
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,0);}
#line 2779 "pikchr.c"
yymsp[0].minor.yy139 = yylhsminor.yy139;
break;
case 82: /* place2 ::= object DOT_E edge */
#line 687 "pikchr.y"
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
#line 2785 "pikchr.c"
yymsp[-2].minor.yy139 = yylhsminor.yy139;
break;
case 83: /* place2 ::= NTH VERTEX OF object */
#line 688 "pikchr.y"
{yylhsminor.yy139 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy254);}
#line 2791 "pikchr.c"
yymsp[-3].minor.yy139 = yylhsminor.yy139;
break;
case 84: /* object ::= nth */
#line 700 "pikchr.y"
{yylhsminor.yy254 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
#line 2797 "pikchr.c"
yymsp[0].minor.yy254 = yylhsminor.yy254;
break;
case 85: /* object ::= nth OF|IN object */
#line 701 "pikchr.y"
{yylhsminor.yy254 = pik_find_nth(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
#line 2803 "pikchr.c"
yymsp[-2].minor.yy254 = yylhsminor.yy254;
break;
case 86: /* objectname ::= PLACENAME */
#line 703 "pikchr.y"
{yylhsminor.yy254 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
#line 2809 "pikchr.c"
yymsp[0].minor.yy254 = yylhsminor.yy254;
break;
case 87: /* objectname ::= objectname DOT_U PLACENAME */
#line 705 "pikchr.y"
{yylhsminor.yy254 = pik_find_byname(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
#line 2815 "pikchr.c"
yymsp[-2].minor.yy254 = yylhsminor.yy254;
break;
case 88: /* nth ::= NTH CLASSNAME */
#line 707 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
#line 2821 "pikchr.c"
yymsp[-1].minor.yy0 = yylhsminor.yy0;
break;
case 89: /* nth ::= NTH LAST CLASSNAME */
#line 708 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
#line 2827 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 90: /* nth ::= LAST CLASSNAME */
#line 709 "pikchr.y"
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
#line 2833 "pikchr.c"
break;
case 91: /* nth ::= LAST */
#line 710 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
#line 2838 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 92: /* nth ::= NTH LB RB */
#line 711 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
#line 2844 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 93: /* nth ::= NTH LAST LB RB */
#line 712 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
#line 2850 "pikchr.c"
yymsp[-3].minor.yy0 = yylhsminor.yy0;
break;
case 94: /* nth ::= LAST LB RB */
#line 713 "pikchr.y"
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
#line 2856 "pikchr.c"
break;
case 95: /* expr ::= expr PLUS expr */
#line 715 "pikchr.y"
{yylhsminor.yy73=yymsp[-2].minor.yy73+yymsp[0].minor.yy73;}
#line 2861 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 96: /* expr ::= expr MINUS expr */
#line 716 "pikchr.y"
{yylhsminor.yy73=yymsp[-2].minor.yy73-yymsp[0].minor.yy73;}
#line 2867 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 97: /* expr ::= expr STAR expr */
#line 717 "pikchr.y"
{yylhsminor.yy73=yymsp[-2].minor.yy73*yymsp[0].minor.yy73;}
#line 2873 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 98: /* expr ::= expr SLASH expr */
#line 718 "pikchr.y"
{
if( yymsp[0].minor.yy73==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy73 = 0.0; }
else{ yylhsminor.yy73 = yymsp[-2].minor.yy73/yymsp[0].minor.yy73; }
}
#line 2882 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 99: /* expr ::= MINUS expr */
#line 722 "pikchr.y"
{yymsp[-1].minor.yy73=-yymsp[0].minor.yy73;}
#line 2888 "pikchr.c"
break;
case 100: /* expr ::= PLUS expr */
#line 723 "pikchr.y"
{yymsp[-1].minor.yy73=yymsp[0].minor.yy73;}
#line 2893 "pikchr.c"
break;
case 101: /* expr ::= LP expr RP */
#line 724 "pikchr.y"
{yymsp[-2].minor.yy73=yymsp[-1].minor.yy73;}
#line 2898 "pikchr.c"
break;
case 102: /* expr ::= NUMBER */
#line 725 "pikchr.y"
{yylhsminor.yy73=pik_atof(p,&yymsp[0].minor.yy0);}
#line 2903 "pikchr.c"
yymsp[0].minor.yy73 = yylhsminor.yy73;
break;
case 103: /* expr ::= ID */
#line 726 "pikchr.y"
{yylhsminor.yy73=pik_get_var(p,&yymsp[0].minor.yy0);}
#line 2909 "pikchr.c"
yymsp[0].minor.yy73 = yylhsminor.yy73;
break;
case 104: /* expr ::= FUNC1 LP expr RP */
#line 727 "pikchr.y"
{yylhsminor.yy73 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy73,0.0);}
#line 2915 "pikchr.c"
yymsp[-3].minor.yy73 = yylhsminor.yy73;
break;
case 105: /* expr ::= FUNC2 LP expr COMMA expr RP */
#line 728 "pikchr.y"
{yylhsminor.yy73 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy73,yymsp[-1].minor.yy73);}
#line 2921 "pikchr.c"
yymsp[-5].minor.yy73 = yylhsminor.yy73;
break;
case 106: /* expr ::= place2 DOT_XY X */
#line 729 "pikchr.y"
{yylhsminor.yy73 = yymsp[-2].minor.yy139.x;}
#line 2927 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 107: /* expr ::= place2 DOT_XY Y */
#line 730 "pikchr.y"
{yylhsminor.yy73 = yymsp[-2].minor.yy139.y;}
#line 2933 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
case 108: /* expr ::= object DOT_L numproperty */
case 109: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==109);
case 110: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==110);
#line 731 "pikchr.y"
{yylhsminor.yy73=pik_property_of(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
#line 2941 "pikchr.c"
yymsp[-2].minor.yy73 = yylhsminor.yy73;
break;
default:
/* (111) lvalue ::= ID */ yytestcase(yyruleno==111);
/* (112) lvalue ::= FILL */ yytestcase(yyruleno==112);
/* (113) lvalue ::= COLOR */ yytestcase(yyruleno==113);
/* (114) lvalue ::= THICKNESS */ yytestcase(yyruleno==114);
|
| ︙ | ︙ | |||
3010 3011 3012 3013 3014 3015 3016 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
| | | | 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
#line 498 "pikchr.y"
if( TOKEN.z && TOKEN.z[0] ){
pik_error(p, &TOKEN, "syntax error");
}else{
pik_error(p, 0, "syntax error");
}
#line 3051 "pikchr.c"
/************ End %syntax_error code ******************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
pik_parserCTX_STORE
}
/*
** The following is executed when the parser accepts
|
| ︙ | ︙ | |||
3250 3251 3252 3253 3254 3255 3256 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif } | | | 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif } #line 736 "pikchr.y" /* Chart of the 140 official HTML color names with their ** corresponding RGB value. ** ** Two new names "None" and "Off" are added with a value |
| ︙ | ︙ | |||
4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 |
pik_append_clr(p, "fill:", pElem->fill, ";");
}else{
pik_append(p,"fill:none;",-1);
}
if( pElem->sw>0.0 && pElem->color>=0.0 ){
PNum sw = pElem->sw;
pik_append_dis(p, "stroke-width:", sw, ";");
pik_append_clr(p, "stroke:",pElem->color,";");
if( pElem->dotted>0.0 ){
PNum v = pElem->dotted;
if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
pik_append_dis(p,"stroke-dasharray:",sw,"");
pik_append_dis(p,",",v,";");
}else if( pElem->dashed>0.0 ){
| > > > | 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 |
pik_append_clr(p, "fill:", pElem->fill, ";");
}else{
pik_append(p,"fill:none;",-1);
}
if( pElem->sw>0.0 && pElem->color>=0.0 ){
PNum sw = pElem->sw;
pik_append_dis(p, "stroke-width:", sw, ";");
if( pElem->nPath>2 && pElem->rad<=pElem->sw ){
pik_append(p, "stroke-linejoin:round;", -1);
}
pik_append_clr(p, "stroke:",pElem->color,";");
if( pElem->dotted>0.0 ){
PNum v = pElem->dotted;
if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
pik_append_dis(p,"stroke-dasharray:",sw,"");
pik_append_dis(p,",",v,";");
}else if( pElem->dashed>0.0 ){
|
| ︙ | ︙ | |||
5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 |
pElem->dashed = v;
pElem->dotted = 0.0;
break;
}
}
}
/* Add a new term to the path for a line-oriented object by transferring
** the information in the ptTo field over onto the path and into ptFrom
** resetting the ptTo.
*/
static void pik_then(Pik *p, PToken *pToken, PElem *pElem){
int n;
if( !pElem->type->isLine ){
pik_error(p, pToken, "use with line-oriented objects only");
return;
}
n = p->nTPath - 1;
| > > > > > > > > > > > | | 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 |
pElem->dashed = v;
pElem->dotted = 0.0;
break;
}
}
}
/*
** If the current path information came from a "same" or "same as"
** reset it.
*/
static void pik_reset_samepath(Pik *p, PElem *pElem){
if( p->samePath ){
p->samePath = 0;
p->nTPath = 1;
}
}
/* Add a new term to the path for a line-oriented object by transferring
** the information in the ptTo field over onto the path and into ptFrom
** resetting the ptTo.
*/
static void pik_then(Pik *p, PToken *pToken, PElem *pElem){
int n;
if( !pElem->type->isLine ){
pik_error(p, pToken, "use with line-oriented objects only");
return;
}
n = p->nTPath - 1;
if( n<1 && (pElem->mProp & A_FROM)==0 ){
pik_error(p, pToken, "no prior path points");
return;
}
p->thenFlag = 1;
}
/* Advance to the next entry in p->aTPath. Return its index.
|
| ︙ | ︙ | |||
5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 |
pik_error(p, pDir, "use with line-oriented objects only");
}else{
PToken x = pik_next_semantic_token(p, &pElem->errTok);
pik_error(p, &x, "syntax error");
}
return;
}
n = p->nTPath - 1;
if( p->thenFlag || p->mTPath==3 || n==0 ){
n = pik_next_rpath(p, pDir);
p->thenFlag = 0;
}
dir = pDir ? pDir->eCode : p->eDir;
switch( dir ){
| > | 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 |
pik_error(p, pDir, "use with line-oriented objects only");
}else{
PToken x = pik_next_semantic_token(p, &pElem->errTok);
pik_error(p, &x, "syntax error");
}
return;
}
pik_reset_samepath(p, pElem);
n = p->nTPath - 1;
if( p->thenFlag || p->mTPath==3 || n==0 ){
n = pik_next_rpath(p, pDir);
p->thenFlag = 0;
}
dir = pDir ? pDir->eCode : p->eDir;
switch( dir ){
|
| ︙ | ︙ | |||
5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 |
PElem *pElem = p->cur;
int n;
PNum rDist = pDist->rAbs + pik_value(p,"linewid",7,0)*pDist->rRel;
if( !pElem->type->isLine ){
pik_error(p, pErr, "use with line-oriented objects only");
return;
}
do{
n = pik_next_rpath(p, pErr);
}while( n<1 );
if( pHeading ){
if( rHdg<0.0 || rHdg>360.0 ){
pik_error(p, pHeading, "headings should be between 0 and 360");
return;
| > | 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 |
PElem *pElem = p->cur;
int n;
PNum rDist = pDist->rAbs + pik_value(p,"linewid",7,0)*pDist->rRel;
if( !pElem->type->isLine ){
pik_error(p, pErr, "use with line-oriented objects only");
return;
}
pik_reset_samepath(p, pElem);
do{
n = pik_next_rpath(p, pErr);
}while( n<1 );
if( pHeading ){
if( rHdg<0.0 || rHdg>360.0 ){
pik_error(p, pHeading, "headings should be between 0 and 360");
return;
|
| ︙ | ︙ | |||
5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 |
static void pik_evenwith(Pik *p, PToken *pDir, PPoint *pPlace){
PElem *pElem = p->cur;
int n;
if( !pElem->type->isLine ){
pik_error(p, pDir, "use with line-oriented objects only");
return;
}
n = p->nTPath - 1;
if( p->thenFlag || p->mTPath==3 || n==0 ){
n = pik_next_rpath(p, pDir);
p->thenFlag = 0;
}
switch( pDir->eCode ){
case DIR_DOWN:
| > | 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 |
static void pik_evenwith(Pik *p, PToken *pDir, PPoint *pPlace){
PElem *pElem = p->cur;
int n;
if( !pElem->type->isLine ){
pik_error(p, pDir, "use with line-oriented objects only");
return;
}
pik_reset_samepath(p, pElem);
n = p->nTPath - 1;
if( p->thenFlag || p->mTPath==3 || n==0 ){
n = pik_next_rpath(p, pDir);
p->thenFlag = 0;
}
switch( pDir->eCode ){
case DIR_DOWN:
|
| ︙ | ︙ | |||
5898 5899 5900 5901 5902 5903 5904 5905 |
dy = p->aTPath[0].y - pOther->aPath[0].y;
for(i=1; i<pOther->nPath; i++){
p->aTPath[i].x = pOther->aPath[i].x + dx;
p->aTPath[i].y = pOther->aPath[i].y + dy;
}
p->nTPath = pOther->nPath;
p->mTPath = 3;
}
| > > | | > | | 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 |
dy = p->aTPath[0].y - pOther->aPath[0].y;
for(i=1; i<pOther->nPath; i++){
p->aTPath[i].x = pOther->aPath[i].x + dx;
p->aTPath[i].y = pOther->aPath[i].y + dy;
}
p->nTPath = pOther->nPath;
p->mTPath = 3;
p->samePath = 1;
}
if( !pElem->type->isLine ){
pElem->w = pOther->w;
pElem->h = pOther->h;
}
pElem->rad = pOther->rad;
pElem->sw = pOther->sw;
pElem->dashed = pOther->dashed;
pElem->dotted = pOther->dotted;
pElem->fill = pOther->fill;
pElem->color = pOther->color;
pElem->cw = pOther->cw;
pElem->larrow = pOther->larrow;
pElem->rarrow = pOther->rarrow;
pElem->bClose = pOther->bClose;
pElem->bChop = pOther->bChop;
|
| ︙ | ︙ | |||
7027 7028 7029 7030 7031 7032 7033 |
}
}
printf("</body></html>\n");
return 0;
}
#endif /* PIKCHR_SHELL */
| | | 7049 7050 7051 7052 7053 7054 7055 7056 |
}
}
printf("</body></html>\n");
return 0;
}
#endif /* PIKCHR_SHELL */
#line 7081 "pikchr.c"
|
Changes to src/shell.c.
| ︙ | ︙ | |||
567 568 569 570 571 572 573 |
** in bytes. This is different from the %*.*s specification in printf
** since with %*.*s the width is measured in bytes, not characters.
*/
static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
int i;
int n;
int aw = w<0 ? -w : w;
| < < | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
** in bytes. This is different from the %*.*s specification in printf
** since with %*.*s the width is measured in bytes, not characters.
*/
static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
int i;
int n;
int aw = w<0 ? -w : w;
for(i=n=0; zUtf[i]; i++){
if( (zUtf[i]&0xc0)!=0x80 ){
n++;
if( n==aw ){
do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
break;
}
|
| ︙ | ︙ | |||
5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 |
(void*)&aFunc[i].iAux,
aFunc[i].xFunc, 0, 0);
}
return rc;
}
/************************* End ../ext/misc/ieee754.c ********************/
#ifdef SQLITE_HAVE_ZLIB
/************************* Begin ../ext/misc/zipfile.c ******************/
/*
** 2017-12-26
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 |
(void*)&aFunc[i].iAux,
aFunc[i].xFunc, 0, 0);
}
return rc;
}
/************************* End ../ext/misc/ieee754.c ********************/
/************************* Begin ../ext/misc/series.c ******************/
/*
** 2015-08-18
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file demonstrates how to create a table-valued-function using
** a virtual table. This demo implements the generate_series() function
** which gives similar results to the eponymous function in PostgreSQL.
** Examples:
**
** SELECT * FROM generate_series(0,100,5);
**
** The query above returns integers from 0 through 100 counting by steps
** of 5.
**
** SELECT * FROM generate_series(0,100);
**
** Integers from 0 through 100 with a step size of 1.
**
** SELECT * FROM generate_series(20) LIMIT 10;
**
** Integers 20 through 29.
**
** HOW IT WORKS
**
** The generate_series "function" is really a virtual table with the
** following schema:
**
** CREATE TABLE generate_series(
** value,
** start HIDDEN,
** stop HIDDEN,
** step HIDDEN
** );
**
** Function arguments in queries against this virtual table are translated
** into equality constraints against successive hidden columns. In other
** words, the following pairs of queries are equivalent to each other:
**
** SELECT * FROM generate_series(0,100,5);
** SELECT * FROM generate_series WHERE start=0 AND stop=100 AND step=5;
**
** SELECT * FROM generate_series(0,100);
** SELECT * FROM generate_series WHERE start=0 AND stop=100;
**
** SELECT * FROM generate_series(20) LIMIT 10;
** SELECT * FROM generate_series WHERE start=20 LIMIT 10;
**
** The generate_series virtual table implementation leaves the xCreate method
** set to NULL. This means that it is not possible to do a CREATE VIRTUAL
** TABLE command with "generate_series" as the USING argument. Instead, there
** is a single generate_series virtual table that is always available without
** having to be created first.
**
** The xBestIndex method looks for equality constraints against the hidden
** start, stop, and step columns, and if present, it uses those constraints
** to bound the sequence of generated values. If the equality constraints
** are missing, it uses 0 for start, 4294967295 for stop, and 1 for step.
** xBestIndex returns a small cost when both start and stop are available,
** and a very large cost if either start or stop are unavailable. This
** encourages the query planner to order joins such that the bounds of the
** series are well-defined.
*/
/* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* series_cursor is a subclass of sqlite3_vtab_cursor which will
** serve as the underlying representation of a cursor that scans
** over rows of the result
*/
typedef struct series_cursor series_cursor;
struct series_cursor {
sqlite3_vtab_cursor base; /* Base class - must be first */
int isDesc; /* True to count down rather than up */
sqlite3_int64 iRowid; /* The rowid */
sqlite3_int64 iValue; /* Current value ("value") */
sqlite3_int64 mnValue; /* Mimimum value ("start") */
sqlite3_int64 mxValue; /* Maximum value ("stop") */
sqlite3_int64 iStep; /* Increment ("step") */
};
/*
** The seriesConnect() method is invoked to create a new
** series_vtab that describes the generate_series virtual table.
**
** Think of this routine as the constructor for series_vtab objects.
**
** All this routine needs to do is:
**
** (1) Allocate the series_vtab object and initialize all fields.
**
** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
** result set of queries against generate_series will look like.
*/
static int seriesConnect(
sqlite3 *db,
void *pAux,
int argc, const char *const*argv,
sqlite3_vtab **ppVtab,
char **pzErr
){
sqlite3_vtab *pNew;
int rc;
/* Column numbers */
#define SERIES_COLUMN_VALUE 0
#define SERIES_COLUMN_START 1
#define SERIES_COLUMN_STOP 2
#define SERIES_COLUMN_STEP 3
rc = sqlite3_declare_vtab(db,
"CREATE TABLE x(value,start hidden,stop hidden,step hidden)");
if( rc==SQLITE_OK ){
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
}
return rc;
}
/*
** This method is the destructor for series_cursor objects.
*/
static int seriesDisconnect(sqlite3_vtab *pVtab){
sqlite3_free(pVtab);
return SQLITE_OK;
}
/*
** Constructor for a new series_cursor object.
*/
static int seriesOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
series_cursor *pCur;
pCur = sqlite3_malloc( sizeof(*pCur) );
if( pCur==0 ) return SQLITE_NOMEM;
memset(pCur, 0, sizeof(*pCur));
*ppCursor = &pCur->base;
return SQLITE_OK;
}
/*
** Destructor for a series_cursor.
*/
static int seriesClose(sqlite3_vtab_cursor *cur){
sqlite3_free(cur);
return SQLITE_OK;
}
/*
** Advance a series_cursor to its next row of output.
*/
static int seriesNext(sqlite3_vtab_cursor *cur){
series_cursor *pCur = (series_cursor*)cur;
if( pCur->isDesc ){
pCur->iValue -= pCur->iStep;
}else{
pCur->iValue += pCur->iStep;
}
pCur->iRowid++;
return SQLITE_OK;
}
/*
** Return values of columns for the row at which the series_cursor
** is currently pointing.
*/
static int seriesColumn(
sqlite3_vtab_cursor *cur, /* The cursor */
sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
int i /* Which column to return */
){
series_cursor *pCur = (series_cursor*)cur;
sqlite3_int64 x = 0;
switch( i ){
case SERIES_COLUMN_START: x = pCur->mnValue; break;
case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
case SERIES_COLUMN_STEP: x = pCur->iStep; break;
default: x = pCur->iValue; break;
}
sqlite3_result_int64(ctx, x);
return SQLITE_OK;
}
/*
** Return the rowid for the current row. In this implementation, the
** first row returned is assigned rowid value 1, and each subsequent
** row a value 1 more than that of the previous.
*/
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
series_cursor *pCur = (series_cursor*)cur;
*pRowid = pCur->iRowid;
return SQLITE_OK;
}
/*
** Return TRUE if the cursor has been moved off of the last
** row of output.
*/
static int seriesEof(sqlite3_vtab_cursor *cur){
series_cursor *pCur = (series_cursor*)cur;
if( pCur->isDesc ){
return pCur->iValue < pCur->mnValue;
}else{
return pCur->iValue > pCur->mxValue;
}
}
/* True to cause run-time checking of the start=, stop=, and/or step=
** parameters. The only reason to do this is for testing the
** constraint checking logic for virtual tables in the SQLite core.
*/
#ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
# define SQLITE_SERIES_CONSTRAINT_VERIFY 0
#endif
/*
** This method is called to "rewind" the series_cursor object back
** to the first row of output. This method is always called at least
** once prior to any call to seriesColumn() or seriesRowid() or
** seriesEof().
**
** The query plan selected by seriesBestIndex is passed in the idxNum
** parameter. (idxStr is not used in this implementation.) idxNum
** is a bitmask showing which constraints are available:
**
** 1: start=VALUE
** 2: stop=VALUE
** 4: step=VALUE
**
** Also, if bit 8 is set, that means that the series should be output
** in descending order rather than in ascending order.
**
** This routine should initialize the cursor and position it so that it
** is pointing at the first row, or pointing off the end of the table
** (so that seriesEof() will return true) if the table is empty.
*/
static int seriesFilter(
sqlite3_vtab_cursor *pVtabCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
if( idxNum & 1 ){
pCur->mnValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mnValue = 0;
}
if( idxNum & 2 ){
pCur->mxValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mxValue = 0xffffffff;
}
if( idxNum & 4 ){
pCur->iStep = sqlite3_value_int64(argv[i++]);
if( pCur->iStep<1 ) pCur->iStep = 1;
}else{
pCur->iStep = 1;
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
pCur->mnValue = 1;
pCur->mxValue = 0;
break;
}
}
if( idxNum & 8 ){
pCur->isDesc = 1;
pCur->iValue = pCur->mxValue;
if( pCur->iStep>0 ){
pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
}
}else{
pCur->isDesc = 0;
pCur->iValue = pCur->mnValue;
}
pCur->iRowid = 1;
return SQLITE_OK;
}
/*
** SQLite will invoke this method one or more times while planning a query
** that uses the generate_series virtual table. This routine needs to create
** a query plan for each invocation and compute an estimated cost for that
** plan.
**
** In this implementation idxNum is used to represent the
** query plan. idxStr is unused.
**
** The query plan is represented by bits in idxNum:
**
** (1) start = $value -- constraint exists
** (2) stop = $value -- constraint exists
** (4) step = $value -- constraint exists
** (8) output in descending order
*/
static int seriesBestIndex(
sqlite3_vtab *tab,
sqlite3_index_info *pIdxInfo
){
int i, j; /* Loop over constraints */
int idxNum = 0; /* The query plan bitmask */
int unusableMask = 0; /* Mask of unusable constraints */
int nArg = 0; /* Number of arguments that seriesFilter() expects */
int aIdx[3]; /* Constraints on start, stop, and step */
const struct sqlite3_index_constraint *pConstraint;
/* This implementation assumes that the start, stop, and step columns
** are the last three columns in the virtual table. */
assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );
aIdx[0] = aIdx[1] = aIdx[2] = -1;
pConstraint = pIdxInfo->aConstraint;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
int iCol; /* 0 for start, 1 for stop, 2 for step */
int iMask; /* bitmask for those column */
if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
iCol = pConstraint->iColumn - SERIES_COLUMN_START;
assert( iCol>=0 && iCol<=2 );
iMask = 1 << iCol;
if( pConstraint->usable==0 ){
unusableMask |= iMask;
continue;
}else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
idxNum |= iMask;
aIdx[iCol] = i;
}
}
for(i=0; i<3; i++){
if( (j = aIdx[i])>=0 ){
pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
}
}
if( (unusableMask & ~idxNum)!=0 ){
/* The start, stop, and step columns are inputs. Therefore if there
** are unusable constraints on any of start, stop, or step then
** this plan is unusable */
return SQLITE_CONSTRAINT;
}
if( (idxNum & 3)==3 ){
/* Both start= and stop= boundaries are available. This is the
** the preferred case */
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
pIdxInfo->estimatedRows = 1000;
if( pIdxInfo->nOrderBy==1 ){
if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;
pIdxInfo->orderByConsumed = 1;
}
}else{
/* If either boundary is missing, we have to generate a huge span
** of numbers. Make this case very expensive so that the query
** planner will work hard to avoid it. */
pIdxInfo->estimatedRows = 2147483647;
}
pIdxInfo->idxNum = idxNum;
return SQLITE_OK;
}
/*
** This following structure defines all the methods for the
** generate_series virtual table.
*/
static sqlite3_module seriesModule = {
0, /* iVersion */
0, /* xCreate */
seriesConnect, /* xConnect */
seriesBestIndex, /* xBestIndex */
seriesDisconnect, /* xDisconnect */
0, /* xDestroy */
seriesOpen, /* xOpen - open a cursor */
seriesClose, /* xClose - close a cursor */
seriesFilter, /* xFilter - configure scan constraints */
seriesNext, /* xNext - advance a cursor */
seriesEof, /* xEof - check for end of scan */
seriesColumn, /* xColumn - read data */
seriesRowid, /* xRowid - read data */
0, /* xUpdate */
0, /* xBegin */
0, /* xSync */
0, /* xCommit */
0, /* xRollback */
0, /* xFindMethod */
0, /* xRename */
};
#endif /* SQLITE_OMIT_VIRTUALTABLE */
#ifdef _WIN32
#endif
int sqlite3_series_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( sqlite3_libversion_number()<3008012 ){
*pzErrMsg = sqlite3_mprintf(
"generate_series() requires SQLite 3.8.12 or later");
return SQLITE_ERROR;
}
rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
#endif
return rc;
}
/************************* End ../ext/misc/series.c ********************/
#ifdef SQLITE_HAVE_ZLIB
/************************* Begin ../ext/misc/zipfile.c ******************/
/*
** 2017-12-26
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
|
| ︙ | ︙ | |||
5838 5839 5840 5841 5842 5843 5844 |
}
static int zipfileAppendData(
ZipfileTab *pTab,
const u8 *aWrite,
int nWrite
){
| > | | | | | | | | > | 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 |
}
static int zipfileAppendData(
ZipfileTab *pTab,
const u8 *aWrite,
int nWrite
){
if( nWrite>0 ){
size_t n = nWrite;
fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
if( (int)n!=nWrite ){
pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
return SQLITE_ERROR;
}
pTab->szCurrent += nWrite;
}
return SQLITE_OK;
}
/*
** Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
*/
static u16 zipfileGetU16(const u8 *aBuf){
|
| ︙ | ︙ | |||
14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 |
const char *zName = (const char*)sqlite3_value_text(argv[0]);
UNUSED_PARAMETER(argc);
if( zName ){
char *z = sqlite3_mprintf("\"%w\"", zName);
sqlite3_result_text(context, z, -1, sqlite3_free);
}
}
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
** function quote(). If the first character of the input is "'",
** indicating that the value passed to quote() was a text value,
** then this function searches the input for "\n" and "\r" characters
| > > > > > > > > > > > > > | 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 |
const char *zName = (const char*)sqlite3_value_text(argv[0]);
UNUSED_PARAMETER(argc);
if( zName ){
char *z = sqlite3_mprintf("\"%w\"", zName);
sqlite3_result_text(context, z, -1, sqlite3_free);
}
}
/*
** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
*/
static void shellUSleepFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
int sleep = sqlite3_value_int(argv[0]);
sqlite3_sleep(sleep/1000);
sqlite3_result_int(context, sleep);
}
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
** function quote(). If the first character of the input is "'",
** indicating that the value passed to quote() was a text value,
** then this function searches the input for "\n" and "\r" characters
|
| ︙ | ︙ | |||
14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 |
#endif
sqlite3_fileio_init(p->db, 0, 0);
sqlite3_shathree_init(p->db, 0, 0);
sqlite3_completion_init(p->db, 0, 0);
sqlite3_uint_init(p->db, 0, 0);
sqlite3_decimal_init(p->db, 0, 0);
sqlite3_ieee_init(p->db, 0, 0);
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
sqlite3_dbdata_init(p->db, 0, 0);
#endif
#ifdef SQLITE_HAVE_ZLIB
sqlite3_zipfile_init(p->db, 0, 0);
sqlite3_sqlar_init(p->db, 0, 0);
#endif
sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
shellAddSchemaName, 0, 0);
sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
shellModuleSchema, 0, 0);
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
shellPutsFunc, 0, 0);
sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
shellEscapeCrnl, 0, 0);
sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
shellInt32, 0, 0);
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
shellIdQuote, 0, 0);
#ifndef SQLITE_NOHAVE_SYSTEM
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
editFunc, 0, 0);
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
editFunc, 0, 0);
#endif
if( p->openMode==SHELL_OPEN_ZIPFILE ){
| > > > | 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 |
#endif
sqlite3_fileio_init(p->db, 0, 0);
sqlite3_shathree_init(p->db, 0, 0);
sqlite3_completion_init(p->db, 0, 0);
sqlite3_uint_init(p->db, 0, 0);
sqlite3_decimal_init(p->db, 0, 0);
sqlite3_ieee_init(p->db, 0, 0);
sqlite3_series_init(p->db, 0, 0);
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
sqlite3_dbdata_init(p->db, 0, 0);
#endif
#ifdef SQLITE_HAVE_ZLIB
sqlite3_zipfile_init(p->db, 0, 0);
sqlite3_sqlar_init(p->db, 0, 0);
#endif
sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
shellAddSchemaName, 0, 0);
sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
shellModuleSchema, 0, 0);
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
shellPutsFunc, 0, 0);
sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
shellEscapeCrnl, 0, 0);
sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
shellInt32, 0, 0);
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
shellIdQuote, 0, 0);
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
shellUSleepFunc, 0, 0);
#ifndef SQLITE_NOHAVE_SYSTEM
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
editFunc, 0, 0);
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
editFunc, 0, 0);
#endif
if( p->openMode==SHELL_OPEN_ZIPFILE ){
|
| ︙ | ︙ | |||
17165 17166 17167 17168 17169 17170 17171 |
}else{
raw_printf(stderr, "Usage: .clone FILENAME\n");
rc = 1;
}
}else
if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
| | | > > < < < < < | < | | < > > > > > > > > > | > > > > > > > > > > > > > > > > | 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 |
}else{
raw_printf(stderr, "Usage: .clone FILENAME\n");
rc = 1;
}
}else
if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
char **azName = 0;
int nName = 0;
sqlite3_stmt *pStmt;
int i;
open_db(p, 0);
rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
if( rc ){
utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
rc = 1;
}else{
while( sqlite3_step(pStmt)==SQLITE_ROW ){
const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
azName[nName*2] = strdup(zSchema);
azName[nName*2+1] = strdup(zFile);
nName++;
}
}
sqlite3_finalize(pStmt);
for(i=0; i<nName; i++){
int eTxn = sqlite3_txn_state(p->db, azName[i*2]);
int bRdonly = sqlite3_db_readonly(p->db, azName[i*2]);
const char *z = azName[i*2+1];
utf8_printf(p->out, "%s: %s %s%s\n",
azName[i*2],
z && z[0] ? z : "\"\"",
bRdonly ? "r/o" : "r/w",
eTxn==SQLITE_TXN_NONE ? "" :
eTxn==SQLITE_TXN_READ ? " read-txn" : " write-txn");
free(azName[i*2]);
free(azName[i*2+1]);
}
sqlite3_free(azName);
}else
if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
static const struct DbConfigChoices {
const char *zName;
int op;
} aDbConfig[] = {
|
| ︙ | ︙ | |||
19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 |
#ifdef YYCOVERAGE
{ "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
#endif
{ "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
};
int testctrl = -1;
int iCtrl = -1;
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
int isOk = 0;
int i, n2;
const char *zCmd = 0;
| > | 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 |
#ifdef YYCOVERAGE
{ "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
#endif
{ "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
{ "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
};
int testctrl = -1;
int iCtrl = -1;
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
int isOk = 0;
int i, n2;
const char *zCmd = 0;
|
| ︙ | ︙ | |||
19495 19496 19497 19498 19499 19500 19501 |
isOk = 3;
}
break;
/* sqlite3_test_control(int) */
case SQLITE_TESTCTRL_PRNG_SAVE:
case SQLITE_TESTCTRL_PRNG_RESTORE:
| < | 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 |
isOk = 3;
}
break;
/* sqlite3_test_control(int) */
case SQLITE_TESTCTRL_PRNG_SAVE:
case SQLITE_TESTCTRL_PRNG_RESTORE:
case SQLITE_TESTCTRL_BYTEORDER:
if( nArg==2 ){
rc2 = sqlite3_test_control(testctrl);
isOk = testctrl==SQLITE_TESTCTRL_BYTEORDER ? 1 : 3;
}
break;
|
| ︙ | ︙ | |||
19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 |
rc2 = sqlite3_test_control(testctrl, p->db,
azArg[2],
integerValue(azArg[3]),
integerValue(azArg[4]));
isOk = 3;
}
break;
#ifdef YYCOVERAGE
case SQLITE_TESTCTRL_PARSER_COVERAGE:
if( nArg==2 ){
sqlite3_test_control(testctrl, p->out);
isOk = 3;
}
| > > > > > > > > | 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 |
rc2 = sqlite3_test_control(testctrl, p->db,
azArg[2],
integerValue(azArg[3]),
integerValue(azArg[4]));
isOk = 3;
}
break;
case SQLITE_TESTCTRL_SEEK_COUNT: {
u64 x = 0;
rc2 = sqlite3_test_control(testctrl, p->db, &x);
utf8_printf(p->out, "%llu\n", x);
isOk = 3;
break;
}
#ifdef YYCOVERAGE
case SQLITE_TESTCTRL_PARSER_COVERAGE:
if( nArg==2 ){
sqlite3_test_control(testctrl, p->out);
isOk = 3;
}
|
| ︙ | ︙ |
Changes to src/sqlite3.c.
| ︙ | ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.34.0" #define SQLITE_VERSION_NUMBER 3034000 | | | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.34.0" #define SQLITE_VERSION_NUMBER 3034000 #define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
7243 7244 7245 7246 7247 7248 7249 | ** then the highest transaction state of any schema on databse connection D ** is returned. Transaction states are (in order of lowest to highest): ** <ol> ** <li value="0"> SQLITE_TXN_NONE ** <li value="1"> SQLITE_TXN_READ ** <li value="2"> SQLITE_TXN_WRITE ** </ol> | | | 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 |
** then the highest transaction state of any schema on databse connection D
** is returned. Transaction states are (in order of lowest to highest):
** <ol>
** <li value="0"> SQLITE_TXN_NONE
** <li value="1"> SQLITE_TXN_READ
** <li value="2"> SQLITE_TXN_WRITE
** </ol>
** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
** a valid schema, then -1 is returned.
*/
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
/*
** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
** KEYWORDS: {transaction state}
|
| ︙ | ︙ | |||
8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 | ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ | > | 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 | ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_SEEK_COUNT 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ |
| ︙ | ︙ | |||
15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 | SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *); #endif SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *); SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt); SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void); #ifndef NDEBUG SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); #endif SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*); | > > > > > > | 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 | SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *); #endif SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *); SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt); SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void); #ifdef SQLITE_DEBUG SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree*); #else # define sqlite3BtreeSeekCount(X) 0 #endif #ifndef NDEBUG SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); #endif SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*); |
| ︙ | ︙ | |||
15726 15727 15728 15729 15730 15731 15732 | #define OP_SorterOpen 111 #define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ #define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ #define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */ #define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */ #define OP_Close 116 #define OP_ColumnsUsed 117 | | | 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 | #define OP_SorterOpen 111 #define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ #define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ #define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */ #define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */ #define OP_Close 116 #define OP_ColumnsUsed 117 #define OP_SeekHit 118 /* synopsis: set P2<=seekHit<=P3 */ #define OP_Sequence 119 /* synopsis: r[P2]=cursor[P1].ctr++ */ #define OP_NewRowid 120 /* synopsis: r[P2]=rowid */ #define OP_Insert 121 /* synopsis: intkey=r[P3] data=r[P2] */ #define OP_Delete 122 #define OP_ResetCount 123 #define OP_SorterCompare 124 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ #define OP_SorterData 125 /* synopsis: r[P2]=data */ |
| ︙ | ︙ | |||
19592 19593 19594 19595 19596 19597 19598 | SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*); #else # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */ #endif SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*); SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int); SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); | | | 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 |
SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*);
#else
# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
#endif
SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*);
SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*);
SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
sqlite3_vfs**,char**,char **);
#define sqlite3CodecQueryParameters(A,B,C) 0
|
| ︙ | ︙ | |||
20840 20841 20842 20843 20844 20845 20846 | #ifdef SQLITE_DEBUG u8 seekOp; /* Most recent seek operation on this cursor */ u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */ #endif Bool isEphemeral:1; /* True for an ephemeral table */ Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */ Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ | | | 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 | #ifdef SQLITE_DEBUG u8 seekOp; /* Most recent seek operation on this cursor */ u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */ #endif Bool isEphemeral:1; /* True for an ephemeral table */ Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */ Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */ Btree *pBtx; /* Separate file holding temporary table */ i64 seqCount; /* Sequence counter */ u32 *aAltMap; /* Mapping from table to index column numbers */ /* Cached OP_Column parse information is only valid if cacheStatus matches ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that |
| ︙ | ︙ | |||
28612 28613 28614 28615 28616 28617 28618 |
}else{
v = va_arg(ap,long int);
}
}else{
v = va_arg(ap,int);
}
if( v<0 ){
| | > | < | < | 28619 28620 28621 28622 28623 28624 28625 28626 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 |
}else{
v = va_arg(ap,long int);
}
}else{
v = va_arg(ap,int);
}
if( v<0 ){
testcase( v==SMALLEST_INT64 );
testcase( v==(-1) );
longvalue = ~v;
longvalue++;
prefix = '-';
}else{
longvalue = v;
prefix = flag_prefix;
}
}else{
if( bArgList ){
|
| ︙ | ︙ | |||
31912 31913 31914 31915 31916 31917 31918 31919 31920 31921 31922 31923 31924 31925 |
const char *zStart;
const char *zEnd = zNum + length;
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
if( enc==SQLITE_UTF8 ){
incr = 1;
}else{
incr = 2;
assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
for(i=3-enc; i<length && zNum[i]==0; i+=2){}
nonNum = i<length;
zEnd = &zNum[i^1];
zNum += (enc&1);
}
while( zNum<zEnd && sqlite3Isspace(*zNum) ) zNum+=incr;
| > | 31918 31919 31920 31921 31922 31923 31924 31925 31926 31927 31928 31929 31930 31931 31932 |
const char *zStart;
const char *zEnd = zNum + length;
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
if( enc==SQLITE_UTF8 ){
incr = 1;
}else{
incr = 2;
length &= ~1;
assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
for(i=3-enc; i<length && zNum[i]==0; i+=2){}
nonNum = i<length;
zEnd = &zNum[i^1];
zNum += (enc&1);
}
while( zNum<zEnd && sqlite3Isspace(*zNum) ) zNum+=incr;
|
| ︙ | ︙ | |||
33328 33329 33330 33331 33332 33333 33334 |
/* 111 */ "SorterOpen" OpHelp(""),
/* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
/* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
/* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
/* 115 */ "String8" OpHelp("r[P2]='P4'"),
/* 116 */ "Close" OpHelp(""),
/* 117 */ "ColumnsUsed" OpHelp(""),
| | | 33335 33336 33337 33338 33339 33340 33341 33342 33343 33344 33345 33346 33347 33348 33349 |
/* 111 */ "SorterOpen" OpHelp(""),
/* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
/* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
/* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
/* 115 */ "String8" OpHelp("r[P2]='P4'"),
/* 116 */ "Close" OpHelp(""),
/* 117 */ "ColumnsUsed" OpHelp(""),
/* 118 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
/* 119 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
/* 120 */ "NewRowid" OpHelp("r[P2]=rowid"),
/* 121 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
/* 122 */ "Delete" OpHelp(""),
/* 123 */ "ResetCount" OpHelp(""),
/* 124 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
/* 125 */ "SorterData" OpHelp("r[P2]=data"),
|
| ︙ | ︙ | |||
35138 35139 35140 35141 35142 35143 35144 35145 35146 35147 35148 35149 35150 35151 |
sqlite3_mutex_leave(pFile->pInode->pLockMutex);
OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
*pResOut = reserved;
return rc;
}
/*
** Set a posix-advisory-lock.
**
** There are two versions of this routine. If compiled with
** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
** which is a pointer to a unixFile. If the unixFile->iBusyTimeout
** value is set, then it is the number of milliseconds to wait before
| > > > | 35145 35146 35147 35148 35149 35150 35151 35152 35153 35154 35155 35156 35157 35158 35159 35160 35161 |
sqlite3_mutex_leave(pFile->pInode->pLockMutex);
OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
*pResOut = reserved;
return rc;
}
/* Forward declaration*/
static int unixSleep(sqlite3_vfs*,int);
/*
** Set a posix-advisory-lock.
**
** There are two versions of this routine. If compiled with
** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
** which is a pointer to a unixFile. If the unixFile->iBusyTimeout
** value is set, then it is the number of milliseconds to wait before
|
| ︙ | ︙ | |||
35167 35168 35169 35170 35171 35172 35173 |
int rc = osFcntl(h,F_SETLK,pLock);
while( rc<0 && tm>0 ){
/* On systems that support some kind of blocking file lock with a timeout,
** make appropriate changes here to invoke that blocking file lock. On
** generic posix, however, there is no such API. So we simply try the
** lock once every millisecond until either the timeout expires, or until
** the lock is obtained. */
| | | 35177 35178 35179 35180 35181 35182 35183 35184 35185 35186 35187 35188 35189 35190 35191 |
int rc = osFcntl(h,F_SETLK,pLock);
while( rc<0 && tm>0 ){
/* On systems that support some kind of blocking file lock with a timeout,
** make appropriate changes here to invoke that blocking file lock. On
** generic posix, however, there is no such API. So we simply try the
** lock once every millisecond until either the timeout expires, or until
** the lock is obtained. */
unixSleep(0,1000);
rc = osFcntl(h,F_SETLK,pLock);
tm--;
}
return rc;
}
#endif /* SQLITE_ENABLE_SETLK_TIMEOUT */
|
| ︙ | ︙ | |||
35738 35739 35740 35741 35742 35743 35744 35745 35746 35747 35748 35749 35750 35751 |
** descriptor to pInode->pUnused list. It will be automatically closed
** when the last lock is cleared.
*/
setPendingFd(pFile);
}
sqlite3_mutex_leave(pInode->pLockMutex);
releaseInodeInfo(pFile);
rc = closeUnixFile(id);
unixLeaveMutex();
return rc;
}
/************** End of the posix advisory lock implementation *****************
******************************************************************************/
| > | 35748 35749 35750 35751 35752 35753 35754 35755 35756 35757 35758 35759 35760 35761 35762 |
** descriptor to pInode->pUnused list. It will be automatically closed
** when the last lock is cleared.
*/
setPendingFd(pFile);
}
sqlite3_mutex_leave(pInode->pLockMutex);
releaseInodeInfo(pFile);
assert( pFile->pShm==0 );
rc = closeUnixFile(id);
unixLeaveMutex();
return rc;
}
/************** End of the posix advisory lock implementation *****************
******************************************************************************/
|
| ︙ | ︙ | |||
37848 37849 37850 37851 37852 37853 37854 37855 37856 37857 37858 37859 37860 37861 | int szRegion; /* Size of shared-memory regions */ u16 nRegion; /* Size of array apRegion */ u8 isReadonly; /* True if read-only */ u8 isUnlocked; /* True if no DMS lock held */ char **apRegion; /* Array of mapped shared-memory regions */ int nRef; /* Number of unixShm objects pointing to this */ unixShm *pFirst; /* All unixShm objects pointing to this */ #ifdef SQLITE_DEBUG u8 exclMask; /* Mask of exclusive locks held */ u8 sharedMask; /* Mask of shared locks held */ u8 nextShmId; /* Next available unixShm.id value */ #endif }; | > | 37859 37860 37861 37862 37863 37864 37865 37866 37867 37868 37869 37870 37871 37872 37873 | int szRegion; /* Size of shared-memory regions */ u16 nRegion; /* Size of array apRegion */ u8 isReadonly; /* True if read-only */ u8 isUnlocked; /* True if no DMS lock held */ char **apRegion; /* Array of mapped shared-memory regions */ int nRef; /* Number of unixShm objects pointing to this */ unixShm *pFirst; /* All unixShm objects pointing to this */ int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */ #ifdef SQLITE_DEBUG u8 exclMask; /* Mask of exclusive locks held */ u8 sharedMask; /* Mask of shared locks held */ u8 nextShmId; /* Next available unixShm.id value */ #endif }; |
| ︙ | ︙ | |||
38388 38389 38390 38391 38392 38393 38394 38395 38396 38397 38398 38399 38400 38401 38402 38403 38404 38405 38406 38407 38408 38409 38410 |
*pp = 0;
}
if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
sqlite3_mutex_leave(pShmNode->pShmMutex);
return rc;
}
/*
** Change the lock state for a shared-memory segment.
**
** Note that the relationship between SHAREd and EXCLUSIVE locks is a little
** different here than in posix. In xShmLock(), one can go from unlocked
** to shared and back or from unlocked to exclusive and back. But one may
** not go from shared to exclusive or from exclusive to shared.
*/
static int unixShmLock(
sqlite3_file *fd, /* Database file holding the shared memory */
int ofst, /* First lock to acquire or release */
int n, /* Number of locks to acquire or release */
int flags /* What to do with the lock */
){
unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
unixShm *p = pDbFd->pShm; /* The shared memory being locked */
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > | 38400 38401 38402 38403 38404 38405 38406 38407 38408 38409 38410 38411 38412 38413 38414 38415 38416 38417 38418 38419 38420 38421 38422 38423 38424 38425 38426 38427 38428 38429 38430 38431 38432 38433 38434 38435 38436 38437 38438 38439 38440 38441 38442 38443 38444 38445 38446 38447 38448 38449 38450 38451 38452 38453 38454 38455 38456 38457 38458 38459 38460 38461 38462 38463 38464 38465 |
*pp = 0;
}
if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
sqlite3_mutex_leave(pShmNode->pShmMutex);
return rc;
}
/*
** Check that the pShmNode->aLock[] array comports with the locking bitmasks
** held by each client. Return true if it does, or false otherwise. This
** is to be used in an assert(). e.g.
**
** assert( assertLockingArrayOk(pShmNode) );
*/
#ifdef SQLITE_DEBUG
static int assertLockingArrayOk(unixShmNode *pShmNode){
unixShm *pX;
int aLock[SQLITE_SHM_NLOCK];
assert( sqlite3_mutex_held(pShmNode->pShmMutex) );
memset(aLock, 0, sizeof(aLock));
for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
int i;
for(i=0; i<SQLITE_SHM_NLOCK; i++){
if( pX->exclMask & (1<<i) ){
assert( aLock[i]==0 );
aLock[i] = -1;
}else if( pX->sharedMask & (1<<i) ){
assert( aLock[i]>=0 );
aLock[i]++;
}
}
}
assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) );
return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0);
}
#endif
/*
** Change the lock state for a shared-memory segment.
**
** Note that the relationship between SHAREd and EXCLUSIVE locks is a little
** different here than in posix. In xShmLock(), one can go from unlocked
** to shared and back or from unlocked to exclusive and back. But one may
** not go from shared to exclusive or from exclusive to shared.
*/
static int unixShmLock(
sqlite3_file *fd, /* Database file holding the shared memory */
int ofst, /* First lock to acquire or release */
int n, /* Number of locks to acquire or release */
int flags /* What to do with the lock */
){
unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
unixShm *p = pDbFd->pShm; /* The shared memory being locked */
unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
int rc = SQLITE_OK; /* Result code */
u16 mask; /* Mask of locks to take or release */
int *aLock = pShmNode->aLock;
assert( pShmNode==pDbFd->pInode->pShmNode );
assert( pShmNode->pInode==pDbFd->pInode );
assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
assert( n>=1 );
assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)
|| flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)
|
| ︙ | ︙ | |||
38446 38447 38448 38449 38450 38451 38452 38453 |
&& (ofst<3 || (p->exclMask|p->sharedMask)<(1<<ofst))
));
#endif
mask = (1<<(ofst+n)) - (1<<ofst);
assert( n>1 || mask==(1<<ofst) );
sqlite3_mutex_enter(pShmNode->pShmMutex);
if( flags & SQLITE_SHM_UNLOCK ){
| > > > | < | < | | | | | | | < | > > > > > | | | | | | > < | | < < < < | > < < < < | < < < < < < | | | | > | > | < > | | > | | < > > | | | > > | 38490 38491 38492 38493 38494 38495 38496 38497 38498 38499 38500 38501 38502 38503 38504 38505 38506 38507 38508 38509 38510 38511 38512 38513 38514 38515 38516 38517 38518 38519 38520 38521 38522 38523 38524 38525 38526 38527 38528 38529 38530 38531 38532 38533 38534 38535 38536 38537 38538 38539 38540 38541 38542 38543 38544 38545 38546 38547 38548 38549 38550 38551 38552 38553 38554 38555 38556 38557 38558 38559 38560 38561 38562 38563 38564 38565 38566 38567 38568 38569 38570 38571 38572 38573 |
&& (ofst<3 || (p->exclMask|p->sharedMask)<(1<<ofst))
));
#endif
mask = (1<<(ofst+n)) - (1<<ofst);
assert( n>1 || mask==(1<<ofst) );
sqlite3_mutex_enter(pShmNode->pShmMutex);
assert( assertLockingArrayOk(pShmNode) );
if( flags & SQLITE_SHM_UNLOCK ){
if( (p->exclMask|p->sharedMask) & mask ){
int ii;
int bUnlock = 1;
for(ii=ofst; ii<ofst+n; ii++){
if( aLock[ii]>((p->sharedMask & (1<<ii)) ? 1 : 0) ){
bUnlock = 0;
}
}
if( bUnlock ){
rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
if( rc==SQLITE_OK ){
memset(&aLock[ofst], 0, sizeof(int)*n);
}
}else if( p->sharedMask & (1<<ofst) ){
assert( n==1 && aLock[ofst]>1 );
aLock[ofst]--;
}
/* Undo the local locks */
if( rc==SQLITE_OK ){
p->exclMask &= ~mask;
p->sharedMask &= ~mask;
}
}
}else if( flags & SQLITE_SHM_SHARED ){
assert( n==1 );
assert( (p->exclMask & (1<<ofst))==0 );
if( (p->sharedMask & mask)==0 ){
if( aLock[ofst]<0 ){
rc = SQLITE_BUSY;
}else if( aLock[ofst]==0 ){
rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
}
/* Get the local shared locks */
if( rc==SQLITE_OK ){
p->sharedMask |= mask;
aLock[ofst]++;
}
}
}else{
/* Make sure no sibling connections hold locks that will block this
** lock. If any do, return SQLITE_BUSY right away. */
int ii;
for(ii=ofst; ii<ofst+n; ii++){
assert( (p->sharedMask & mask)==0 );
if( (p->exclMask & (1<<ii))==0 && aLock[ii] ){
rc = SQLITE_BUSY;
break;
}
}
/* Get the exclusive locks at the system level. Then if successful
** also update the in-memory values. */
if( rc==SQLITE_OK ){
rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
if( rc==SQLITE_OK ){
assert( (p->sharedMask & mask)==0 );
p->exclMask |= mask;
for(ii=ofst; ii<ofst+n; ii++){
aLock[ii] = -1;
}
}
}
}
assert( assertLockingArrayOk(pShmNode) );
sqlite3_mutex_leave(pShmNode->pShmMutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
p->id, osGetpid(0), p->sharedMask, p->exclMask));
return rc;
}
/*
|
| ︙ | ︙ | |||
40137 40138 40139 40140 40141 40142 40143 | sp.tv_sec = microseconds / 1000000; sp.tv_nsec = (microseconds % 1000000) * 1000; nanosleep(&sp, NULL); UNUSED_PARAMETER(NotUsed); return microseconds; #elif defined(HAVE_USLEEP) && HAVE_USLEEP | > | | 40179 40180 40181 40182 40183 40184 40185 40186 40187 40188 40189 40190 40191 40192 40193 40194 | sp.tv_sec = microseconds / 1000000; sp.tv_nsec = (microseconds % 1000000) * 1000; nanosleep(&sp, NULL); UNUSED_PARAMETER(NotUsed); return microseconds; #elif defined(HAVE_USLEEP) && HAVE_USLEEP if( microseconds>=1000000 ) sleep(microseconds/1000000); if( microseconds%1000000 ) usleep(microseconds%1000000); UNUSED_PARAMETER(NotUsed); return microseconds; #else int seconds = (microseconds+999999)/1000000; sleep(seconds); UNUSED_PARAMETER(NotUsed); return seconds*1000000; |
| ︙ | ︙ | |||
40710 40711 40712 40713 40714 40715 40716 |
if( osFstat(conchFile->h, &buf) ){
storeLastErrno(pFile, errno);
return SQLITE_IOERR_LOCK;
}
if( nTries==1 ){
conchModTime = buf.st_mtimespec;
| | | 40753 40754 40755 40756 40757 40758 40759 40760 40761 40762 40763 40764 40765 40766 40767 |
if( osFstat(conchFile->h, &buf) ){
storeLastErrno(pFile, errno);
return SQLITE_IOERR_LOCK;
}
if( nTries==1 ){
conchModTime = buf.st_mtimespec;
unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
continue;
}
assert( nTries>1 );
if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec ||
conchModTime.tv_nsec != buf.st_mtimespec.tv_nsec ){
return SQLITE_BUSY;
|
| ︙ | ︙ | |||
40736 40737 40738 40739 40740 40741 40742 |
if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){
return SQLITE_BUSY;
}
}else{
/* don't break the lock on short read or a version mismatch */
return SQLITE_BUSY;
}
| | | 40779 40780 40781 40782 40783 40784 40785 40786 40787 40788 40789 40790 40791 40792 40793 |
if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){
return SQLITE_BUSY;
}
}else{
/* don't break the lock on short read or a version mismatch */
return SQLITE_BUSY;
}
unixSleep(0,10000000); /* wait 10 sec and try the lock again */
continue;
}
assert( nTries==3 );
if( 0==proxyBreakConchLock(pFile, myHostID) ){
rc = SQLITE_OK;
if( lockType==EXCLUSIVE_LOCK ){
|
| ︙ | ︙ | |||
63874 63875 63876 63877 63878 63879 63880 63881 63882 63883 63884 63885 63886 63887 | u8 locked; /* True if db currently has pBt locked */ u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */ int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */ int nBackup; /* Number of backup operations reading this btree */ u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */ Btree *pNext; /* List of other sharable Btrees from the same db */ Btree *pPrev; /* Back pointer of the same list */ #ifndef SQLITE_OMIT_SHARED_CACHE BtLock lock; /* Object used to lock page 1 */ #endif }; /* ** Btree.inTrans may take one of the following values. | > > > | 63917 63918 63919 63920 63921 63922 63923 63924 63925 63926 63927 63928 63929 63930 63931 63932 63933 | u8 locked; /* True if db currently has pBt locked */ u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */ int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */ int nBackup; /* Number of backup operations reading this btree */ u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */ Btree *pNext; /* List of other sharable Btrees from the same db */ Btree *pPrev; /* Back pointer of the same list */ #ifdef SQLITE_DEBUG u64 nSeek; /* Calls to sqlite3BtreeMovetoUnpacked() */ #endif #ifndef SQLITE_OMIT_SHARED_CACHE BtLock lock; /* Object used to lock page 1 */ #endif }; /* ** Btree.inTrans may take one of the following values. |
| ︙ | ︙ | |||
64654 64655 64656 64657 64658 64659 64660 64661 64662 64663 64664 64665 64666 64667 | #define querySharedCacheTableLock(a,b,c) SQLITE_OK #define setSharedCacheTableLock(a,b,c) SQLITE_OK #define clearAllSharedCacheTableLocks(a) #define downgradeAllSharedCacheTableLocks(a) #define hasSharedCacheTableLock(a,b,c,d) 1 #define hasReadConflicts(a, b) 0 #endif /* ** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single ** (MemPage*) as an argument. The (MemPage*) must not be NULL. ** ** If SQLITE_DEBUG is not defined, then this macro is equivalent to ** SQLITE_CORRUPT_BKPT. Or, if SQLITE_DEBUG is set, then the log message | > > > > > > > > > > > | 64700 64701 64702 64703 64704 64705 64706 64707 64708 64709 64710 64711 64712 64713 64714 64715 64716 64717 64718 64719 64720 64721 64722 64723 64724 |
#define querySharedCacheTableLock(a,b,c) SQLITE_OK
#define setSharedCacheTableLock(a,b,c) SQLITE_OK
#define clearAllSharedCacheTableLocks(a)
#define downgradeAllSharedCacheTableLocks(a)
#define hasSharedCacheTableLock(a,b,c,d) 1
#define hasReadConflicts(a, b) 0
#endif
#ifdef SQLITE_DEBUG
/*
** Return an reset the seek counter for a Btree object.
*/
SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree *pBt){
u64 n = pBt->nSeek;
pBt->nSeek = 0;
return n;
}
#endif
/*
** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
** (MemPage*) as an argument. The (MemPage*) must not be NULL.
**
** If SQLITE_DEBUG is not defined, then this macro is equivalent to
** SQLITE_CORRUPT_BKPT. Or, if SQLITE_DEBUG is set, then the log message
|
| ︙ | ︙ | |||
67148 67149 67150 67151 67152 67153 67154 |
sqlite3_file *pFile;
/* If the B-Tree was successfully opened, set the pager-cache size to the
** default value. Except, when opening on an existing shared pager-cache,
** do not change the pager-cache size.
*/
if( sqlite3BtreeSchema(p, 0, 0)==0 ){
| | | 67205 67206 67207 67208 67209 67210 67211 67212 67213 67214 67215 67216 67217 67218 67219 |
sqlite3_file *pFile;
/* If the B-Tree was successfully opened, set the pager-cache size to the
** default value. Except, when opening on an existing shared pager-cache,
** do not change the pager-cache size.
*/
if( sqlite3BtreeSchema(p, 0, 0)==0 ){
sqlite3BtreeSetCacheSize(p, SQLITE_DEFAULT_CACHE_SIZE);
}
pFile = sqlite3PagerFile(pBt->pPager);
if( pFile->pMethods ){
sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db);
}
}
|
| ︙ | ︙ | |||
70001 70002 70003 70004 70005 70006 70007 70008 70009 70010 70011 70012 70013 70014 |
rc = SQLITE_OK;
}else{
return rc;
}
}
}
}
if( pIdxKey ){
xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
pIdxKey->errCode = 0;
assert( pIdxKey->default_rc==1
|| pIdxKey->default_rc==0
|| pIdxKey->default_rc==-1
| > > > > | 70058 70059 70060 70061 70062 70063 70064 70065 70066 70067 70068 70069 70070 70071 70072 70073 70074 70075 |
rc = SQLITE_OK;
}else{
return rc;
}
}
}
}
#ifdef SQLITE_DEBUG
pCur->pBtree->nSeek++; /* Performance measurement during testing */
#endif
if( pIdxKey ){
xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
pIdxKey->errCode = 0;
assert( pIdxKey->default_rc==1
|| pIdxKey->default_rc==0
|| pIdxKey->default_rc==-1
|
| ︙ | ︙ | |||
89765 89766 89767 89768 89769 89770 89771 |
}else if( eqOnly ){
assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
}
break;
}
| | | | > > > > > | > | < | > | > > > | 89826 89827 89828 89829 89830 89831 89832 89833 89834 89835 89836 89837 89838 89839 89840 89841 89842 89843 89844 89845 89846 89847 89848 89849 89850 89851 89852 89853 89854 89855 89856 89857 89858 89859 89860 89861 89862 89863 89864 |
}else if( eqOnly ){
assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
}
break;
}
/* Opcode: SeekHit P1 P2 P3 * *
** Synopsis: set P2<=seekHit<=P3
**
** Increase or decrease the seekHit value for cursor P1, if necessary,
** so that it is no less than P2 and no greater than P3.
**
** The seekHit integer represents the maximum of terms in an index for which
** there is known to be at least one match. If the seekHit value is smaller
** than the total number of equality terms in an index lookup, then the
** OP_IfNoHope opcode might run to see if the IN loop can be abandoned
** early, thus saving work. This is part of the IN-early-out optimization.
**
** P1 must be a valid b-tree cursor.
*/
case OP_SeekHit: {
VdbeCursor *pC;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
assert( pOp->p3>=pOp->p2 );
if( pC->seekHit<pOp->p2 ){
pC->seekHit = pOp->p2;
}else if( pC->seekHit>pOp->p3 ){
pC->seekHit = pOp->p3;
}
break;
}
/* Opcode: IfNotOpen P1 P2 * * *
** Synopsis: if( !csr[P1] ) goto P2
**
** If cursor P1 is not open, jump to instruction P2. Otherwise, fall through.
|
| ︙ | ︙ | |||
89838 89839 89840 89841 89842 89843 89844 | ** ** See also: Found, NotExists, NoConflict, IfNoHope */ /* Opcode: IfNoHope P1 P2 P3 P4 * ** Synopsis: key=r[P3@P4] ** ** Register P3 is the first of P4 registers that form an unpacked | | > > < | < | | > > > > > | < | 89908 89909 89910 89911 89912 89913 89914 89915 89916 89917 89918 89919 89920 89921 89922 89923 89924 89925 89926 89927 89928 89929 89930 89931 89932 89933 89934 89935 | ** ** See also: Found, NotExists, NoConflict, IfNoHope */ /* Opcode: IfNoHope P1 P2 P3 P4 * ** Synopsis: key=r[P3@P4] ** ** Register P3 is the first of P4 registers that form an unpacked ** record. Cursor P1 is an index btree. P2 is a jump destination. ** In other words, the operands to this opcode are the same as the ** operands to OP_NotFound and OP_IdxGT. ** ** This opcode is an optimization attempt only. If this opcode always ** falls through, the correct answer is still obtained, but extra works ** is performed. ** ** A value of N in the seekHit flag of cursor P1 means that there exists ** a key P3:N that will match some record in the index. We want to know ** if it is possible for a record P3:P4 to match some record in the ** index. If it is not possible, we can skips some work. So if seekHit ** is less than P4, attempt to find out if a match is possible by running ** OP_NotFound. ** ** This opcode is used in IN clause processing for a multi-column key. ** If an IN clause is attached to an element of the key other than the ** left-most element, and if there are no matches on the most recent ** seek over the whole key, then it might be that one of the key element ** to the left is prohibiting a match, and hence there is "no hope" of ** any match regardless of how many IN clause elements are checked. |
| ︙ | ︙ | |||
89889 89890 89891 89892 89893 89894 89895 |
** See also: NotFound, Found, NotExists
*/
case OP_IfNoHope: { /* jump, in3 */
VdbeCursor *pC;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
| | | 89963 89964 89965 89966 89967 89968 89969 89970 89971 89972 89973 89974 89975 89976 89977 |
** See also: NotFound, Found, NotExists
*/
case OP_IfNoHope: { /* jump, in3 */
VdbeCursor *pC;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
if( pC->seekHit>=pOp->p4.i ) break;
/* Fall through into OP_NotFound */
/* no break */ deliberate_fall_through
}
case OP_NoConflict: /* jump, in3 */
case OP_NotFound: /* jump, in3 */
case OP_Found: { /* jump, in3 */
int alreadyExists;
|
| ︙ | ︙ | |||
89971 89972 89973 89974 89975 89976 89977 89978 89979 89980 89981 89982 89983 89984 |
pC->cacheStatus = CACHE_STALE;
if( pOp->opcode==OP_Found ){
VdbeBranchTaken(alreadyExists!=0,2);
if( alreadyExists ) goto jump_to_p2;
}else{
VdbeBranchTaken(takeJump||alreadyExists==0,2);
if( takeJump || !alreadyExists ) goto jump_to_p2;
}
break;
}
/* Opcode: SeekRowid P1 P2 P3 * *
** Synopsis: intkey=r[P3]
**
| > | 90045 90046 90047 90048 90049 90050 90051 90052 90053 90054 90055 90056 90057 90058 90059 |
pC->cacheStatus = CACHE_STALE;
if( pOp->opcode==OP_Found ){
VdbeBranchTaken(alreadyExists!=0,2);
if( alreadyExists ) goto jump_to_p2;
}else{
VdbeBranchTaken(takeJump||alreadyExists==0,2);
if( takeJump || !alreadyExists ) goto jump_to_p2;
if( pOp->opcode==OP_IfNoHope ) pC->seekHit = pOp->p4.i;
}
break;
}
/* Opcode: SeekRowid P1 P2 P3 * *
** Synopsis: intkey=r[P3]
**
|
| ︙ | ︙ | |||
91203 91204 91205 91206 91207 91208 91209 |
if( pC->deferredMoveto ){
rc = sqlite3VdbeFinishMoveto(pC);
if( rc ) goto abort_due_to_error;
}
break;
}
| | | | | | 91278 91279 91280 91281 91282 91283 91284 91285 91286 91287 91288 91289 91290 91291 91292 91293 91294 91295 91296 91297 91298 91299 91300 91301 91302 91303 91304 91305 91306 91307 91308 91309 91310 91311 91312 91313 91314 91315 91316 91317 91318 91319 91320 91321 91322 91323 91324 91325 |
if( pC->deferredMoveto ){
rc = sqlite3VdbeFinishMoveto(pC);
if( rc ) goto abort_due_to_error;
}
break;
}
/* Opcode: IdxGE P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the PRIMARY KEY. Compare this key value against the index
** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
** fields at the end.
**
** If the P1 index entry is greater than or equal to the key value
** then jump to P2. Otherwise fall through to the next instruction.
*/
/* Opcode: IdxGT P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the PRIMARY KEY. Compare this key value against the index
** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
** fields at the end.
**
** If the P1 index entry is greater than the key value
** then jump to P2. Otherwise fall through to the next instruction.
*/
/* Opcode: IdxLT P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the PRIMARY KEY or ROWID. Compare this key value against
** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
** ROWID on the P1 index.
**
** If the P1 index entry is less than the key value then jump to P2.
** Otherwise fall through to the next instruction.
*/
/* Opcode: IdxLE P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
** key that omits the PRIMARY KEY or ROWID. Compare this key value against
** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
** ROWID on the P1 index.
**
|
| ︙ | ︙ | |||
91262 91263 91264 91265 91266 91267 91268 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->isOrdered ); assert( pC->eCurType==CURTYPE_BTREE ); assert( pC->uc.pCursor!=0); assert( pC->deferredMoveto==0 ); | < | 91337 91338 91339 91340 91341 91342 91343 91344 91345 91346 91347 91348 91349 91350 |
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
assert( pC->isOrdered );
assert( pC->eCurType==CURTYPE_BTREE );
assert( pC->uc.pCursor!=0);
assert( pC->deferredMoveto==0 );
assert( pOp->p4type==P4_INT32 );
r.pKeyInfo = pC->pKeyInfo;
r.nField = (u16)pOp->p4.i;
if( pOp->opcode<OP_IdxLT ){
assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );
r.default_rc = -1;
}else{
|
| ︙ | ︙ | |||
94909 94910 94911 94912 94913 94914 94915 94916 94917 94918 94919 94920 94921 |
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
pCsr->uc.pSorter = pSorter;
if( pSorter==0 ){
rc = SQLITE_NOMEM_BKPT;
}else{
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
pKeyInfo->db = 0;
if( nField && nWorker==0 ){
pKeyInfo->nKeyField = nField;
}
| > > | > | 94983 94984 94985 94986 94987 94988 94989 94990 94991 94992 94993 94994 94995 94996 94997 94998 94999 95000 95001 95002 95003 95004 95005 95006 |
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
pCsr->uc.pSorter = pSorter;
if( pSorter==0 ){
rc = SQLITE_NOMEM_BKPT;
}else{
Btree *pBt = db->aDb[0].pBt;
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
pKeyInfo->db = 0;
if( nField && nWorker==0 ){
pKeyInfo->nKeyField = nField;
}
sqlite3BtreeEnter(pBt);
pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(pBt);
sqlite3BtreeLeave(pBt);
pSorter->nTask = nWorker + 1;
pSorter->iPrev = (u8)(nWorker - 1);
pSorter->bUseThreads = (pSorter->nTask>1);
pSorter->db = db;
for(i=0; i<pSorter->nTask; i++){
SortSubtask *pTask = &pSorter->aTask[i];
pTask->pSorter = pSorter;
|
| ︙ | ︙ | |||
112069 112070 112071 112072 112073 112074 112075 | return; } /* ** Add a new CHECK constraint to the table currently under construction. */ SQLITE_PRIVATE void sqlite3AddCheckConstraint( | | | > > > > > > > > > | 112146 112147 112148 112149 112150 112151 112152 112153 112154 112155 112156 112157 112158 112159 112160 112161 112162 112163 112164 112165 112166 112167 112168 112169 112170 112171 112172 112173 112174 112175 112176 112177 112178 112179 112180 |
return;
}
/*
** Add a new CHECK constraint to the table currently under construction.
*/
SQLITE_PRIVATE void sqlite3AddCheckConstraint(
Parse *pParse, /* Parsing context */
Expr *pCheckExpr, /* The check expression */
const char *zStart, /* Opening "(" */
const char *zEnd /* Closing ")" */
){
#ifndef SQLITE_OMIT_CHECK
Table *pTab = pParse->pNewTable;
sqlite3 *db = pParse->db;
if( pTab && !IN_DECLARE_VTAB
&& !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
){
pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
if( pParse->constraintName.n ){
sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
}else{
Token t;
for(zStart++; sqlite3Isspace(zStart[0]); zStart++){}
while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; }
t.z = zStart;
t.n = (int)(zEnd - t.z);
sqlite3ExprListSetName(pParse, pTab->pCheck, &t, 1);
}
}else
#endif
{
sqlite3ExprDelete(pParse->db, pCheckExpr);
}
}
|
| ︙ | ︙ | |||
112334 112335 112336 112337 112338 112339 112340 |
** on success and SQLITE_NOMEM on an OOM error.
*/
static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
char *zExtra;
int nByte;
if( pIdx->nColumn>=N ) return SQLITE_OK;
assert( pIdx->isResized==0 );
| | > > > | 112420 112421 112422 112423 112424 112425 112426 112427 112428 112429 112430 112431 112432 112433 112434 112435 112436 112437 112438 112439 112440 112441 112442 |
** on success and SQLITE_NOMEM on an OOM error.
*/
static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
char *zExtra;
int nByte;
if( pIdx->nColumn>=N ) return SQLITE_OK;
assert( pIdx->isResized==0 );
nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N;
zExtra = sqlite3DbMallocZero(db, nByte);
if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
pIdx->azColl = (const char**)zExtra;
zExtra += sizeof(char*)*N;
memcpy(zExtra, pIdx->aiRowLogEst, sizeof(LogEst)*(pIdx->nKeyCol+1));
pIdx->aiRowLogEst = (LogEst*)zExtra;
zExtra += sizeof(LogEst)*N;
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
pIdx->aiColumn = (i16*)zExtra;
zExtra += sizeof(i16)*N;
memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn);
pIdx->aSortOrder = (u8*)zExtra;
pIdx->nColumn = N;
pIdx->isResized = 1;
|
| ︙ | ︙ | |||
122297 122298 122299 122300 122301 122302 122303 |
sqlite3ExprIfTrue(pParse, pCopy, allOk, SQLITE_JUMPIFNULL);
}
sqlite3ExprDelete(db, pCopy);
if( onError==OE_Ignore ){
sqlite3VdbeGoto(v, ignoreDest);
}else{
char *zName = pCheck->a[i].zEName;
| | | 122386 122387 122388 122389 122390 122391 122392 122393 122394 122395 122396 122397 122398 122399 122400 |
sqlite3ExprIfTrue(pParse, pCopy, allOk, SQLITE_JUMPIFNULL);
}
sqlite3ExprDelete(db, pCopy);
if( onError==OE_Ignore ){
sqlite3VdbeGoto(v, ignoreDest);
}else{
char *zName = pCheck->a[i].zEName;
assert( zName!=0 || pParse->db->mallocFailed );
if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
onError, zName, P4_TRANSIENT,
P5_ConstraintCheck);
}
sqlite3VdbeResolveLabel(v, allOk);
}
|
| ︙ | ︙ | |||
129146 129147 129148 129149 129150 129151 129152 129153 129154 129155 129156 129157 129158 129159 |
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
assert( rc==SQLITE_OK || *ppStmt==0 );
}while( rc==SQLITE_ERROR_RETRY
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
assert( (rc&db->errMask)==rc );
sqlite3_mutex_leave(db->mutex);
return rc;
}
/*
** Rerun the compilation of a statement after a schema change.
| > | 129235 129236 129237 129238 129239 129240 129241 129242 129243 129244 129245 129246 129247 129248 129249 |
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
assert( rc==SQLITE_OK || *ppStmt==0 );
}while( rc==SQLITE_ERROR_RETRY
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
assert( (rc&db->errMask)==rc );
db->busyHandler.nBusy = 0;
sqlite3_mutex_leave(db->mutex);
return rc;
}
/*
** Rerun the compilation of a statement after a schema change.
|
| ︙ | ︙ | |||
142154 142155 142156 142157 142158 142159 142160 142161 142162 142163 142164 142165 142166 142167 |
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
| > > > | 142244 142245 142246 142247 142248 142249 142250 142251 142252 142253 142254 142255 142256 142257 142258 142259 142260 |
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
if( iEq>0 ){
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
|
| ︙ | ︙ | |||
142180 142181 142182 142183 142184 142185 142186 |
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
| < > > > | 142273 142274 142275 142276 142277 142278 142279 142280 142281 142282 142283 142284 142285 142286 142287 142288 142289 142290 142291 142292 142293 142294 142295 142296 142297 142298 |
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
if( iEq>0 ){
sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
|
| ︙ | ︙ | |||
143373 143374 143375 143376 143377 143378 143379 |
}
codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);
if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
/* The skip-scan logic inside the call to codeAllEqualityConstraints()
** above has already left the cursor sitting on the correct row,
** so no further seeking is needed */
}else{
| < < < | 143468 143469 143470 143471 143472 143473 143474 143475 143476 143477 143478 143479 143480 143481 |
}
codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);
if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
/* The skip-scan logic inside the call to codeAllEqualityConstraints()
** above has already left the cursor sitting on the correct row,
** so no further seeking is needed */
}else{
if( regBignull ){
sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
VdbeComment((v, "NULL-scan pass ctr"));
}
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
|
| ︙ | ︙ | |||
143486 143487 143488 143489 143490 143491 143492 |
testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT );
testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
| | | 143578 143579 143580 143581 143582 143583 143584 143585 143586 143587 143588 143589 143590 143591 143592 |
testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT );
testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
sqlite3VdbeAddOp3(v, OP_SeekHit, iIdxCur, nEq, nEq);
}
/* Seek the table cursor, if required */
omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0
&& (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
if( omitTable ){
/* pIdx is a covering index. No need to access the main table. */
|
| ︙ | ︙ | |||
154287 154288 154289 154290 154291 154292 154293 154294 | } } #endif /* SQLITE_OMIT_WINDOWFUNC */ /************** End of window.c **********************************************/ /************** Begin file parse.c *******************************************/ /* | > > | | > | < < < < | < < | > | < < < | 154379 154380 154381 154382 154383 154384 154385 154386 154387 154388 154389 154390 154391 154392 154393 154394 154395 154396 154397 154398 154399 154400 154401 154402 154403 154404 154405 154406 154407 154408 154409 154410 154411 154412 154413 154414 |
}
}
#endif /* SQLITE_OMIT_WINDOWFUNC */
/************** End of window.c **********************************************/
/************** Begin file parse.c *******************************************/
/* This file is automatically generated by Lemon from input grammar
** source file "parse.y". */
/*
** 2001-09-15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains SQLite's SQL parser.
**
** The canonical source code to this file ("parse.y") is a Lemon grammar
** file that specifies the input grammar and actions to take while parsing.
** That input file is processed by Lemon to generate a C-language
** implementation of a parser for the given grammer. You might be reading
** this comment as part of the translated C-code. Edits should be made
** to the original parse.y sources.
*/
/* #include "sqliteInt.h" */
/*
** Disable all error recovery processing in the parser push-down
** automaton.
*/
|
| ︙ | ︙ | |||
154497 154498 154499 154500 154501 154502 154503 |
return p;
}
#if TK_SPAN>255
# error too many tokens in the grammar
#endif
/**************** End of %include directives **********************************/
| | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 154584 154585 154586 154587 154588 154589 154590 154591 154592 154593 154594 154595 154596 154597 154598 154599 154600 154601 154602 154603 154604 154605 154606 154607 154608 154609 154610 154611 154612 154613 154614 154615 154616 154617 154618 154619 154620 154621 154622 154623 154624 154625 154626 154627 154628 154629 154630 154631 154632 154633 154634 154635 154636 154637 154638 154639 154640 154641 154642 154643 154644 154645 154646 154647 154648 154649 154650 154651 154652 154653 154654 154655 154656 154657 154658 154659 154660 154661 154662 154663 154664 154665 154666 154667 154668 154669 154670 154671 154672 154673 154674 154675 154676 154677 154678 154679 154680 154681 154682 154683 154684 154685 154686 154687 154688 154689 154690 154691 154692 154693 154694 154695 154696 154697 154698 154699 154700 154701 154702 154703 154704 154705 154706 154707 154708 154709 154710 154711 154712 154713 154714 154715 154716 154717 154718 154719 154720 154721 154722 154723 154724 154725 154726 154727 154728 154729 154730 154731 154732 154733 154734 154735 154736 154737 154738 154739 154740 154741 154742 154743 154744 154745 154746 154747 154748 154749 154750 154751 154752 154753 154754 154755 154756 154757 154758 154759 154760 154761 154762 154763 154764 154765 154766 154767 154768 154769 154770 154771 154772 154773 154774 154775 154776 154777 154778 154779 154780 154781 154782 |
return p;
}
#if TK_SPAN>255
# error too many tokens in the grammar
#endif
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols.
***************** Begin token definitions *************************************/
#ifndef TK_SEMI
#define TK_SEMI 1
#define TK_EXPLAIN 2
#define TK_QUERY 3
#define TK_PLAN 4
#define TK_BEGIN 5
#define TK_TRANSACTION 6
#define TK_DEFERRED 7
#define TK_IMMEDIATE 8
#define TK_EXCLUSIVE 9
#define TK_COMMIT 10
#define TK_END 11
#define TK_ROLLBACK 12
#define TK_SAVEPOINT 13
#define TK_RELEASE 14
#define TK_TO 15
#define TK_TABLE 16
#define TK_CREATE 17
#define TK_IF 18
#define TK_NOT 19
#define TK_EXISTS 20
#define TK_TEMP 21
#define TK_LP 22
#define TK_RP 23
#define TK_AS 24
#define TK_WITHOUT 25
#define TK_COMMA 26
#define TK_ABORT 27
#define TK_ACTION 28
#define TK_AFTER 29
#define TK_ANALYZE 30
#define TK_ASC 31
#define TK_ATTACH 32
#define TK_BEFORE 33
#define TK_BY 34
#define TK_CASCADE 35
#define TK_CAST 36
#define TK_CONFLICT 37
#define TK_DATABASE 38
#define TK_DESC 39
#define TK_DETACH 40
#define TK_EACH 41
#define TK_FAIL 42
#define TK_OR 43
#define TK_AND 44
#define TK_IS 45
#define TK_MATCH 46
#define TK_LIKE_KW 47
#define TK_BETWEEN 48
#define TK_IN 49
#define TK_ISNULL 50
#define TK_NOTNULL 51
#define TK_NE 52
#define TK_EQ 53
#define TK_GT 54
#define TK_LE 55
#define TK_LT 56
#define TK_GE 57
#define TK_ESCAPE 58
#define TK_ID 59
#define TK_COLUMNKW 60
#define TK_DO 61
#define TK_FOR 62
#define TK_IGNORE 63
#define TK_INITIALLY 64
#define TK_INSTEAD 65
#define TK_NO 66
#define TK_KEY 67
#define TK_OF 68
#define TK_OFFSET 69
#define TK_PRAGMA 70
#define TK_RAISE 71
#define TK_RECURSIVE 72
#define TK_REPLACE 73
#define TK_RESTRICT 74
#define TK_ROW 75
#define TK_ROWS 76
#define TK_TRIGGER 77
#define TK_VACUUM 78
#define TK_VIEW 79
#define TK_VIRTUAL 80
#define TK_WITH 81
#define TK_NULLS 82
#define TK_FIRST 83
#define TK_LAST 84
#define TK_CURRENT 85
#define TK_FOLLOWING 86
#define TK_PARTITION 87
#define TK_PRECEDING 88
#define TK_RANGE 89
#define TK_UNBOUNDED 90
#define TK_EXCLUDE 91
#define TK_GROUPS 92
#define TK_OTHERS 93
#define TK_TIES 94
#define TK_GENERATED 95
#define TK_ALWAYS 96
#define TK_REINDEX 97
#define TK_RENAME 98
#define TK_CTIME_KW 99
#define TK_ANY 100
#define TK_BITAND 101
#define TK_BITOR 102
#define TK_LSHIFT 103
#define TK_RSHIFT 104
#define TK_PLUS 105
#define TK_MINUS 106
#define TK_STAR 107
#define TK_SLASH 108
#define TK_REM 109
#define TK_CONCAT 110
#define TK_COLLATE 111
#define TK_BITNOT 112
#define TK_ON 113
#define TK_INDEXED 114
#define TK_STRING 115
#define TK_JOIN_KW 116
#define TK_CONSTRAINT 117
#define TK_DEFAULT 118
#define TK_NULL 119
#define TK_PRIMARY 120
#define TK_UNIQUE 121
#define TK_CHECK 122
#define TK_REFERENCES 123
#define TK_AUTOINCR 124
#define TK_INSERT 125
#define TK_DELETE 126
#define TK_UPDATE 127
#define TK_SET 128
#define TK_DEFERRABLE 129
#define TK_FOREIGN 130
#define TK_DROP 131
#define TK_UNION 132
#define TK_ALL 133
#define TK_EXCEPT 134
#define TK_INTERSECT 135
#define TK_SELECT 136
#define TK_VALUES 137
#define TK_DISTINCT 138
#define TK_DOT 139
#define TK_FROM 140
#define TK_JOIN 141
#define TK_USING 142
#define TK_ORDER 143
#define TK_GROUP 144
#define TK_HAVING 145
#define TK_LIMIT 146
#define TK_WHERE 147
#define TK_INTO 148
#define TK_NOTHING 149
#define TK_FLOAT 150
#define TK_BLOB 151
#define TK_INTEGER 152
#define TK_VARIABLE 153
#define TK_CASE 154
#define TK_WHEN 155
#define TK_THEN 156
#define TK_ELSE 157
#define TK_INDEX 158
#define TK_ALTER 159
#define TK_ADD 160
#define TK_WINDOW 161
#define TK_OVER 162
#define TK_FILTER 163
#define TK_COLUMN 164
#define TK_AGG_FUNCTION 165
#define TK_AGG_COLUMN 166
#define TK_TRUEFALSE 167
#define TK_ISNOT 168
#define TK_FUNCTION 169
#define TK_UMINUS 170
#define TK_UPLUS 171
#define TK_TRUTH 172
#define TK_REGISTER 173
#define TK_VECTOR 174
#define TK_SELECT_COLUMN 175
#define TK_IF_NULL_ROW 176
#define TK_ASTERISK 177
#define TK_SPAN 178
#define TK_SPACE 179
#define TK_ILLEGAL 180
#endif
/**************** End token definitions ***************************************/
/* The next sections is a series of control #defines.
** various aspects of the generated parser.
** YYCODETYPE is the data type used to store the integer codes
** that represent terminal and non-terminal symbols.
** "unsigned char" is used if there are fewer than
** 256 symbols. Larger types otherwise.
|
| ︙ | ︙ | |||
155507 155508 155509 155510 155511 155512 155513 155514 155515 155516 155517 155518 155519 155520 | yyStackEntry *yystackEnd; /* Last entry in the stack */ #endif }; typedef struct yyParser yyParser; #ifndef NDEBUG /* #include <stdio.h> */ static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG /* ** Turn parser tracing on by giving a stream to which to write the trace | > | 155774 155775 155776 155777 155778 155779 155780 155781 155782 155783 155784 155785 155786 155787 155788 | yyStackEntry *yystackEnd; /* Last entry in the stack */ #endif }; typedef struct yyParser yyParser; #ifndef NDEBUG /* #include <stdio.h> */ /* #include <assert.h> */ static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG /* ** Turn parser tracing on by giving a stream to which to write the trace |
| ︙ | ︙ | |||
157774 157775 157776 157777 157778 157779 157780 |
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy192,yymsp[0].minor.yy192,yymsp[-2].minor.yy192);}
break;
case 38: /* ccons ::= UNIQUE onconf */
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 39: /* ccons ::= CHECK LP expr RP */
| | | 158042 158043 158044 158045 158046 158047 158048 158049 158050 158051 158052 158053 158054 158055 158056 |
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy192,yymsp[0].minor.yy192,yymsp[-2].minor.yy192);}
break;
case 38: /* ccons ::= UNIQUE onconf */
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 39: /* ccons ::= CHECK LP expr RP */
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
break;
case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);}
break;
case 41: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy192);}
break;
|
| ︙ | ︙ | |||
157853 157854 157855 157856 157857 157858 157859 |
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy192,yymsp[-2].minor.yy192,0);}
break;
case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 68: /* tcons ::= CHECK LP expr RP onconf */
| | | 158121 158122 158123 158124 158125 158126 158127 158128 158129 158130 158131 158132 158133 158134 158135 |
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy192,yymsp[-2].minor.yy192,0);}
break;
case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 68: /* tcons ::= CHECK LP expr RP onconf */
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
break;
case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
{
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192);
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192);
}
break;
|
| ︙ | ︙ | |||
164930 164931 164932 164933 164934 164935 164936 164937 164938 164939 164940 164941 164942 164943 164944 |
int iNew = *(int*)pArg;
*(int*)pArg = sqlite3BtreeGetRequestedReserve(pBtree);
if( iNew>=0 && iNew<=255 ){
sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
}
rc = SQLITE_OK;
}else{
rc = sqlite3OsFileControl(fd, op, pArg);
}
sqlite3BtreeLeave(pBtree);
}
sqlite3_mutex_leave(db->mutex);
return rc;
}
| > > | 165198 165199 165200 165201 165202 165203 165204 165205 165206 165207 165208 165209 165210 165211 165212 165213 165214 |
int iNew = *(int*)pArg;
*(int*)pArg = sqlite3BtreeGetRequestedReserve(pBtree);
if( iNew>=0 && iNew<=255 ){
sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
}
rc = SQLITE_OK;
}else{
int nSave = db->busyHandler.nBusy;
rc = sqlite3OsFileControl(fd, op, pArg);
db->busyHandler.nBusy = nSave;
}
sqlite3BtreeLeave(pBtree);
}
sqlite3_mutex_leave(db->mutex);
return rc;
}
|
| ︙ | ︙ | |||
165313 165314 165315 165316 165317 165318 165319 165320 165321 165322 165323 165324 165325 165326 |
** for testing purposes.
*/
case SQLITE_TESTCTRL_RESULT_INTREAL: {
sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
sqlite3ResultIntReal(pCtx);
break;
}
}
va_end(ap);
#endif /* SQLITE_UNTESTABLE */
return rc;
}
/*
| > > > > > > > > > > > > > > > > > > > | 165583 165584 165585 165586 165587 165588 165589 165590 165591 165592 165593 165594 165595 165596 165597 165598 165599 165600 165601 165602 165603 165604 165605 165606 165607 165608 165609 165610 165611 165612 165613 165614 165615 |
** for testing purposes.
*/
case SQLITE_TESTCTRL_RESULT_INTREAL: {
sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
sqlite3ResultIntReal(pCtx);
break;
}
/* sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT,
** sqlite3 *db, // Database connection
** u64 *pnSeek // Write seek count here
** );
**
** This test-control queries the seek-counter on the "main" database
** file. The seek-counter is written into *pnSeek and is then reset.
** The seek-count is only available if compiled with SQLITE_DEBUG.
*/
case SQLITE_TESTCTRL_SEEK_COUNT: {
sqlite3 *db = va_arg(ap, sqlite3*);
u64 *pn = va_arg(ap, sqlite3_uint64*);
*pn = sqlite3BtreeSeekCount(db->aDb->pBt);
(void)db; /* Silence harmless unused variable warning */
break;
}
}
va_end(ap);
#endif /* SQLITE_UNTESTABLE */
return rc;
}
/*
|
| ︙ | ︙ | |||
209455 209456 209457 209458 209459 209460 209461 209462 209463 209464 209465 209466 209467 209468 | #define FTS5_LP 10 #define FTS5_RP 11 #define FTS5_CARET 12 #define FTS5_COMMA 13 #define FTS5_PLUS 14 #define FTS5_STAR 15 /* ** 2000-05-29 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. | > > | 209744 209745 209746 209747 209748 209749 209750 209751 209752 209753 209754 209755 209756 209757 209758 209759 | #define FTS5_LP 10 #define FTS5_RP 11 #define FTS5_CARET 12 #define FTS5_COMMA 13 #define FTS5_PLUS 14 #define FTS5_STAR 15 /* This file is automatically generated by Lemon from input grammar ** source file "fts5parse.y". */ /* ** 2000-05-29 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. |
| ︙ | ︙ | |||
209479 209480 209481 209482 209483 209484 209485 | ** the value of the %name directive from the grammar. Otherwise, the content ** of this template is copied straight through into the generate parser ** source file. ** ** The following is the concatenation of all %include directives from the ** input grammar file: */ | < < | 209770 209771 209772 209773 209774 209775 209776 209777 209778 209779 209780 209781 209782 209783 | ** the value of the %name directive from the grammar. Otherwise, the content ** of this template is copied straight through into the generate parser ** source file. ** ** The following is the concatenation of all %include directives from the ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ /* #include "fts5Int.h" */ /* #include "fts5parse.h" */ /* ** Disable all error recovery processing in the parser push-down |
| ︙ | ︙ | |||
209510 209511 209512 209513 209514 209515 209516 | /* ** Alternative datatype for the argument to the malloc() routine passed ** into sqlite3ParserAlloc(). The default is size_t. */ #define fts5YYMALLOCARGTYPE u64 /**************** End of %include directives **********************************/ | | < < | > > > > > > > > > > > > > > > > > | | 209799 209800 209801 209802 209803 209804 209805 209806 209807 209808 209809 209810 209811 209812 209813 209814 209815 209816 209817 209818 209819 209820 209821 209822 209823 209824 209825 209826 209827 209828 209829 209830 209831 209832 | /* ** Alternative datatype for the argument to the malloc() routine passed ** into sqlite3ParserAlloc(). The default is size_t. */ #define fts5YYMALLOCARGTYPE u64 /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef FTS5_OR #define FTS5_OR 1 #define FTS5_AND 2 #define FTS5_NOT 3 #define FTS5_TERM 4 #define FTS5_COLON 5 #define FTS5_MINUS 6 #define FTS5_LCP 7 #define FTS5_RCP 8 #define FTS5_STRING 9 #define FTS5_LP 10 #define FTS5_RP 11 #define FTS5_CARET 12 #define FTS5_COMMA 13 #define FTS5_PLUS 14 #define FTS5_STAR 15 #endif /**************** End token definitions ***************************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. ** fts5YYCODETYPE is the data type used to store the integer codes ** that represent terminal and non-terminal symbols. ** "unsigned char" is used if there are fewer than ** 256 symbols. Larger types otherwise. |
| ︙ | ︙ | |||
209797 209798 209799 209800 209801 209802 209803 209804 209805 209806 209807 209808 209809 209810 | fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ #endif }; typedef struct fts5yyParser fts5yyParser; #ifndef NDEBUG /* #include <stdio.h> */ static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG /* ** Turn parser tracing on by giving a stream to which to write the trace | > | 210101 210102 210103 210104 210105 210106 210107 210108 210109 210110 210111 210112 210113 210114 210115 | fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ #endif }; typedef struct fts5yyParser fts5yyParser; #ifndef NDEBUG /* #include <stdio.h> */ /* #include <assert.h> */ static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG /* ** Turn parser tracing on by giving a stream to which to write the trace |
| ︙ | ︙ | |||
215410 215411 215412 215413 215414 215415 215416 |
}else
if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
Fts5ExprNearset *pNear = pExpr->pNear;
int i;
int iTerm;
if( pNear->pColset ){
| > | > > > > > > > | > | 215715 215716 215717 215718 215719 215720 215721 215722 215723 215724 215725 215726 215727 215728 215729 215730 215731 215732 215733 215734 215735 215736 215737 215738 215739 |
}else
if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
Fts5ExprNearset *pNear = pExpr->pNear;
int i;
int iTerm;
if( pNear->pColset ){
int ii;
Fts5Colset *pColset = pNear->pColset;
if( pColset->nCol>1 ) zRet = fts5PrintfAppend(zRet, "{");
for(ii=0; ii<pColset->nCol; ii++){
zRet = fts5PrintfAppend(zRet, "%s%s",
pConfig->azCol[pColset->aiCol[ii]], ii==pColset->nCol-1 ? "" : " "
);
}
if( zRet ){
zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
}
if( zRet==0 ) return 0;
}
if( pNear->nPhrase>1 ){
zRet = fts5PrintfAppend(zRet, "NEAR(");
if( zRet==0 ) return 0;
}
|
| ︙ | ︙ | |||
225834 225835 225836 225837 225838 225839 225840 |
static void fts5SourceIdFunc(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apUnused /* Function arguments */
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
| | | 226148 226149 226150 226151 226152 226153 226154 226155 226156 226157 226158 226159 226160 226161 226162 |
static void fts5SourceIdFunc(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apUnused /* Function arguments */
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2020-09-11 15:01:49 b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38", -1, SQLITE_TRANSIENT);
}
/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){
|
| ︙ | ︙ | |||
226397 226398 226399 226400 226401 226402 226403 |
nText = sqlite3_value_bytes(apVal[iCol-1]);
}
ctx.szCol = 0;
rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
zText, nText, (void*)&ctx, fts5StorageInsertCallback
);
p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
| > > | | > > > > | > | 226711 226712 226713 226714 226715 226716 226717 226718 226719 226720 226721 226722 226723 226724 226725 226726 226727 226728 226729 226730 226731 226732 226733 226734 |
nText = sqlite3_value_bytes(apVal[iCol-1]);
}
ctx.szCol = 0;
rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
zText, nText, (void*)&ctx, fts5StorageInsertCallback
);
p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
if( p->aTotalSize[iCol-1]<0 ){
rc = FTS5_CORRUPT;
}
}
}
if( rc==SQLITE_OK && p->nTotalRow<1 ){
rc = FTS5_CORRUPT;
}else{
p->nTotalRow--;
}
rc2 = sqlite3_reset(pSeek);
if( rc==SQLITE_OK ) rc = rc2;
return rc;
}
|
| ︙ | ︙ | |||
230617 230618 230619 230620 230621 230622 230623 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 230938 230939 230940 230941 230942 230943 230944 230945 230946 230947 230948 230949 230950 230951 |
#endif
return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
/************** End of stmt.c ************************************************/
#if __LINE__!=230945
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e245alt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
/************************** End of sqlite3.c ******************************/
|
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
121 122 123 124 125 126 127 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.34.0" #define SQLITE_VERSION_NUMBER 3034000 | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.34.0" #define SQLITE_VERSION_NUMBER 3034000 #define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
6195 6196 6197 6198 6199 6200 6201 | ** then the highest transaction state of any schema on databse connection D ** is returned. Transaction states are (in order of lowest to highest): ** <ol> ** <li value="0"> SQLITE_TXN_NONE ** <li value="1"> SQLITE_TXN_READ ** <li value="2"> SQLITE_TXN_WRITE ** </ol> | | | 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 |
** then the highest transaction state of any schema on databse connection D
** is returned. Transaction states are (in order of lowest to highest):
** <ol>
** <li value="0"> SQLITE_TXN_NONE
** <li value="1"> SQLITE_TXN_READ
** <li value="2"> SQLITE_TXN_WRITE
** </ol>
** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
** a valid schema, then -1 is returned.
*/
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
/*
** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
** KEYWORDS: {transaction state}
|
| ︙ | ︙ | |||
7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 | ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ | > | 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 | ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_SEEK_COUNT 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ |
| ︙ | ︙ |