| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.48.0. By combining all the individual C code files into this |
| 3 | +** version 3.50.0. By combining all the individual C code files into this |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| | @@ -16,11 +16,11 @@ |
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | | -** e2bae4143afd07de1ae55a6d2606a3b541a5 with changes in files: |
| 21 | +** 57caa3136d1bfca06e4f2285734a4977b8d3 with changes in files: |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| | @@ -463,13 +463,13 @@ |
| 463 | 463 | ** |
| 464 | 464 | ** See also: [sqlite3_libversion()], |
| 465 | 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | 467 | */ |
| 468 | | -#define SQLITE_VERSION "3.48.0" |
| 469 | | -#define SQLITE_VERSION_NUMBER 3048000 |
| 470 | | -#define SQLITE_SOURCE_ID "2024-12-09 20:46:36 e2bae4143afd07de1ae55a6d2606a3b541a5b94568aa41f6a96e5d1245471653" |
| 468 | +#define SQLITE_VERSION "3.50.0" |
| 469 | +#define SQLITE_VERSION_NUMBER 3050000 |
| 470 | +#define SQLITE_SOURCE_ID "2025-02-18 01:16:26 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc" |
| 471 | 471 | |
| 472 | 472 | /* |
| 473 | 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | 475 | ** |
| | @@ -2306,17 +2306,20 @@ |
| 2306 | 2306 | ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will |
| 2307 | 2307 | ** return [SQLITE_ERROR].</dd> |
| 2308 | 2308 | ** |
| 2309 | 2309 | ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt> |
| 2310 | 2310 | ** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine |
| 2311 | | -** the default size of lookaside memory on each [database connection]. |
| 2311 | +** the default size of [lookaside memory] on each [database connection]. |
| 2312 | 2312 | ** The first argument is the |
| 2313 | | -** size of each lookaside buffer slot and the second is the number of |
| 2314 | | -** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE |
| 2315 | | -** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] |
| 2316 | | -** option to [sqlite3_db_config()] can be used to change the lookaside |
| 2317 | | -** configuration on individual connections.)^ </dd> |
| 2313 | +** size of each lookaside buffer slot ("sz") and the second is the number of |
| 2314 | +** slots allocated to each database connection ("cnt").)^ |
| 2315 | +** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size. |
| 2316 | +** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can |
| 2317 | +** be used to change the lookaside configuration on individual connections.)^ |
| 2318 | +** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the |
| 2319 | +** default lookaside configuration at compile-time. |
| 2320 | +** </dd> |
| 2318 | 2321 | ** |
| 2319 | 2322 | ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt> |
| 2320 | 2323 | ** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is |
| 2321 | 2324 | ** a pointer to an [sqlite3_pcache_methods2] object. This object specifies |
| 2322 | 2325 | ** the interface to a custom page cache implementation.)^ |
| | @@ -2528,11 +2531,19 @@ |
| 2528 | 2531 | |
| 2529 | 2532 | /* |
| 2530 | 2533 | ** CAPI3REF: Database Connection Configuration Options |
| 2531 | 2534 | ** |
| 2532 | 2535 | ** These constants are the available integer configuration options that |
| 2533 | | -** can be passed as the second argument to the [sqlite3_db_config()] interface. |
| 2536 | +** can be passed as the second parameter to the [sqlite3_db_config()] interface. |
| 2537 | +** |
| 2538 | +** The [sqlite3_db_config()] interface is a var-args functions. It takes a |
| 2539 | +** variable number of parameters, though always at least two. The number of |
| 2540 | +** parameters passed into sqlite3_db_config() depends on which of these |
| 2541 | +** constants is given as the second parameter. This documentation page |
| 2542 | +** refers to parameters beyond the second as "arguments". Thus, when this |
| 2543 | +** page says "the N-th argument" it means "the N-th parameter past the |
| 2544 | +** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()". |
| 2534 | 2545 | ** |
| 2535 | 2546 | ** New configuration options may be added in future releases of SQLite. |
| 2536 | 2547 | ** Existing configuration options might be discontinued. Applications |
| 2537 | 2548 | ** should check the return code from [sqlite3_db_config()] to make sure that |
| 2538 | 2549 | ** the call worked. ^The [sqlite3_db_config()] interface will return a |
| | @@ -2540,35 +2551,61 @@ |
| 2540 | 2551 | ** is invoked. |
| 2541 | 2552 | ** |
| 2542 | 2553 | ** <dl> |
| 2543 | 2554 | ** [[SQLITE_DBCONFIG_LOOKASIDE]] |
| 2544 | 2555 | ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt> |
| 2545 | | -** <dd> ^This option takes three additional arguments that determine the |
| 2546 | | -** [lookaside memory allocator] configuration for the [database connection]. |
| 2547 | | -** ^The first argument (the third parameter to [sqlite3_db_config()] is a |
| 2556 | +** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the |
| 2557 | +** configuration of the [lookaside memory allocator] within a database |
| 2558 | +** connection. |
| 2559 | +** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i> |
| 2560 | +** in the [DBCONFIG arguments|usual format]. |
| 2561 | +** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, |
| 2562 | +** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE |
| 2563 | +** should have a total of five parameters. |
| 2564 | +** <ol> |
| 2565 | +** <li><p>The first argument ("buf") is a |
| 2548 | 2566 | ** pointer to a memory buffer to use for lookaside memory. |
| 2549 | | -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb |
| 2550 | | -** may be NULL in which case SQLite will allocate the |
| 2551 | | -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the |
| 2552 | | -** size of each lookaside buffer slot. ^The third argument is the number of |
| 2553 | | -** slots. The size of the buffer in the first argument must be greater than |
| 2554 | | -** or equal to the product of the second and third arguments. The buffer |
| 2555 | | -** must be aligned to an 8-byte boundary. ^If the second argument to |
| 2556 | | -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally |
| 2557 | | -** rounded down to the next smaller multiple of 8. ^(The lookaside memory |
| 2567 | +** The first argument may be NULL in which case SQLite will allocate the |
| 2568 | +** lookaside buffer itself using [sqlite3_malloc()]. |
| 2569 | +** <li><P>The second argument ("sz") is the |
| 2570 | +** size of each lookaside buffer slot. Lookaside is disabled if "sz" |
| 2571 | +** is less than 8. The "sz" argument should be a multiple of 8 less than |
| 2572 | +** 65536. If "sz" does not meet this constraint, it is reduced in size until |
| 2573 | +** it does. |
| 2574 | +** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled |
| 2575 | +** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so |
| 2576 | +** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" |
| 2577 | +** parameter is usually chosen so that the product of "sz" and "cnt" is less |
| 2578 | +** than 1,000,000. |
| 2579 | +** </ol> |
| 2580 | +** <p>If the "buf" argument is not NULL, then it must |
| 2581 | +** point to a memory buffer with a size that is greater than |
| 2582 | +** or equal to the product of "sz" and "cnt". |
| 2583 | +** The buffer must be aligned to an 8-byte boundary. |
| 2584 | +** The lookaside memory |
| 2558 | 2585 | ** configuration for a database connection can only be changed when that |
| 2559 | 2586 | ** connection is not currently using lookaside memory, or in other words |
| 2560 | | -** when the "current value" returned by |
| 2561 | | -** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero. |
| 2587 | +** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero. |
| 2562 | 2588 | ** Any attempt to change the lookaside memory configuration when lookaside |
| 2563 | 2589 | ** memory is in use leaves the configuration unchanged and returns |
| 2564 | | -** [SQLITE_BUSY].)^</dd> |
| 2590 | +** [SQLITE_BUSY]. |
| 2591 | +** If the "buf" argument is NULL and an attempt |
| 2592 | +** to allocate memory based on "sz" and "cnt" fails, then |
| 2593 | +** lookaside is silently disabled. |
| 2594 | +** <p> |
| 2595 | +** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the |
| 2596 | +** default lookaside configuration at initialization. The |
| 2597 | +** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside |
| 2598 | +** configuration at compile-time. Typical values for lookaside are 1200 for |
| 2599 | +** "sz" and 40 to 100 for "cnt". |
| 2600 | +** </dd> |
| 2565 | 2601 | ** |
| 2566 | 2602 | ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] |
| 2567 | 2603 | ** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> |
| 2568 | 2604 | ** <dd> ^This option is used to enable or disable the enforcement of |
| 2569 | | -** [foreign key constraints]. There should be two additional arguments. |
| 2605 | +** [foreign key constraints]. This is the same setting that is |
| 2606 | +** enabled or disabled by the [PRAGMA foreign_keys] statement. |
| 2570 | 2607 | ** The first argument is an integer which is 0 to disable FK enforcement, |
| 2571 | 2608 | ** positive to enable FK enforcement or negative to leave FK enforcement |
| 2572 | 2609 | ** unchanged. The second parameter is a pointer to an integer into which |
| 2573 | 2610 | ** is written 0 or 1 to indicate whether FK enforcement is off or on |
| 2574 | 2611 | ** following this call. The second parameter may be a NULL pointer, in |
| | @@ -2586,17 +2623,17 @@ |
| 2586 | 2623 | ** which case the trigger setting is not reported back. |
| 2587 | 2624 | ** |
| 2588 | 2625 | ** <p>Originally this option disabled all triggers. ^(However, since |
| 2589 | 2626 | ** SQLite version 3.35.0, TEMP triggers are still allowed even if |
| 2590 | 2627 | ** this option is off. So, in other words, this option now only disables |
| 2591 | | -** triggers in the main database schema or in the schemas of ATTACH-ed |
| 2628 | +** triggers in the main database schema or in the schemas of [ATTACH]-ed |
| 2592 | 2629 | ** databases.)^ </dd> |
| 2593 | 2630 | ** |
| 2594 | 2631 | ** [[SQLITE_DBCONFIG_ENABLE_VIEW]] |
| 2595 | 2632 | ** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt> |
| 2596 | 2633 | ** <dd> ^This option is used to enable or disable [CREATE VIEW | views]. |
| 2597 | | -** There should be two additional arguments. |
| 2634 | +** There must be two additional arguments. |
| 2598 | 2635 | ** The first argument is an integer which is 0 to disable views, |
| 2599 | 2636 | ** positive to enable views or negative to leave the setting unchanged. |
| 2600 | 2637 | ** The second parameter is a pointer to an integer into which |
| 2601 | 2638 | ** is written 0 or 1 to indicate whether views are disabled or enabled |
| 2602 | 2639 | ** following this call. The second parameter may be a NULL pointer, in |
| | @@ -2611,11 +2648,11 @@ |
| 2611 | 2648 | ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] |
| 2612 | 2649 | ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> |
| 2613 | 2650 | ** <dd> ^This option is used to enable or disable the |
| 2614 | 2651 | ** [fts3_tokenizer()] function which is part of the |
| 2615 | 2652 | ** [FTS3] full-text search engine extension. |
| 2616 | | -** There should be two additional arguments. |
| 2653 | +** There must be two additional arguments. |
| 2617 | 2654 | ** The first argument is an integer which is 0 to disable fts3_tokenizer() or |
| 2618 | 2655 | ** positive to enable fts3_tokenizer() or negative to leave the setting |
| 2619 | 2656 | ** unchanged. |
| 2620 | 2657 | ** The second parameter is a pointer to an integer into which |
| 2621 | 2658 | ** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled |
| | @@ -2626,11 +2663,11 @@ |
| 2626 | 2663 | ** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt> |
| 2627 | 2664 | ** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()] |
| 2628 | 2665 | ** interface independently of the [load_extension()] SQL function. |
| 2629 | 2666 | ** The [sqlite3_enable_load_extension()] API enables or disables both the |
| 2630 | 2667 | ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. |
| 2631 | | -** There should be two additional arguments. |
| 2668 | +** There must be two additional arguments. |
| 2632 | 2669 | ** When the first argument to this interface is 1, then only the C-API is |
| 2633 | 2670 | ** enabled and the SQL function remains disabled. If the first argument to |
| 2634 | 2671 | ** this interface is 0, then both the C-API and the SQL function are disabled. |
| 2635 | 2672 | ** If the first argument is -1, then no changes are made to state of either the |
| 2636 | 2673 | ** C-API or the SQL function. |
| | @@ -2640,27 +2677,34 @@ |
| 2640 | 2677 | ** be a NULL pointer, in which case the new setting is not reported back. |
| 2641 | 2678 | ** </dd> |
| 2642 | 2679 | ** |
| 2643 | 2680 | ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| 2644 | 2681 | ** <dd> ^This option is used to change the name of the "main" database |
| 2645 | | -** schema. ^The sole argument is a pointer to a constant UTF8 string |
| 2646 | | -** which will become the new schema name in place of "main". ^SQLite |
| 2647 | | -** does not make a copy of the new main schema name string, so the application |
| 2648 | | -** must ensure that the argument passed into this DBCONFIG option is unchanged |
| 2649 | | -** until after the database connection closes. |
| 2682 | +** schema. This option does not follow the |
| 2683 | +** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format]. |
| 2684 | +** This option takes exactly one additional argument so that the |
| 2685 | +** [sqlite3_db_config()] call has a total of three parameters. The |
| 2686 | +** extra argument must be a pointer to a constant UTF8 string which |
| 2687 | +** will become the new schema name in place of "main". ^SQLite does |
| 2688 | +** not make a copy of the new main schema name string, so the application |
| 2689 | +** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME |
| 2690 | +** is unchanged until after the database connection closes. |
| 2650 | 2691 | ** </dd> |
| 2651 | 2692 | ** |
| 2652 | 2693 | ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| 2653 | 2694 | ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| 2654 | | -** <dd> Usually, when a database in wal mode is closed or detached from a |
| 2655 | | -** database handle, SQLite checks if this will mean that there are now no |
| 2656 | | -** connections at all to the database. If so, it performs a checkpoint |
| 2657 | | -** operation before closing the connection. This option may be used to |
| 2658 | | -** override this behavior. The first parameter passed to this operation |
| 2659 | | -** is an integer - positive to disable checkpoints-on-close, or zero (the |
| 2660 | | -** default) to enable them, and negative to leave the setting unchanged. |
| 2661 | | -** The second parameter is a pointer to an integer |
| 2695 | +** <dd> Usually, when a database in [WAL mode] is closed or detached from a |
| 2696 | +** database handle, SQLite checks if if there are other connections to the |
| 2697 | +** same database, and if there are no other database connection (if the |
| 2698 | +** connection being closed is the last open connection to the database), |
| 2699 | +** then SQLite performs a [checkpoint] before closing the connection and |
| 2700 | +** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can |
| 2701 | +** be used to override that behavior. The first argument passed to this |
| 2702 | +** operation (the third parameter to [sqlite3_db_config()]) is an integer |
| 2703 | +** which is positive to disable checkpoints-on-close, or zero (the default) |
| 2704 | +** to enable them, and negative to leave the setting unchanged. |
| 2705 | +** The second argument (the fourth parameter) is a pointer to an integer |
| 2662 | 2706 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 2663 | 2707 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 2664 | 2708 | ** </dd> |
| 2665 | 2709 | ** |
| 2666 | 2710 | ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| | @@ -2817,11 +2861,11 @@ |
| 2817 | 2861 | ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears |
| 2818 | 2862 | ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2() |
| 2819 | 2863 | ** statistics. For statistics to be collected, the flag must be set on |
| 2820 | 2864 | ** the database handle both when the SQL statement is prepared and when it |
| 2821 | 2865 | ** is stepped. The flag is set (collection of statistics is enabled) |
| 2822 | | -** by default. This option takes two arguments: an integer and a pointer to |
| 2866 | +** by default. <p>This option takes two arguments: an integer and a pointer to |
| 2823 | 2867 | ** an integer.. The first argument is 1, 0, or -1 to enable, disable, or |
| 2824 | 2868 | ** leave unchanged the statement scanstatus option. If the second argument |
| 2825 | 2869 | ** is not NULL, then the value of the statement scanstatus setting after |
| 2826 | 2870 | ** processing the first argument is written into the integer that the second |
| 2827 | 2871 | ** argument points to. |
| | @@ -2831,20 +2875,89 @@ |
| 2831 | 2875 | ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt> |
| 2832 | 2876 | ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order |
| 2833 | 2877 | ** in which tables and indexes are scanned so that the scans start at the end |
| 2834 | 2878 | ** and work toward the beginning rather than starting at the beginning and |
| 2835 | 2879 | ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the |
| 2836 | | -** same as setting [PRAGMA reverse_unordered_selects]. This option takes |
| 2880 | +** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes |
| 2837 | 2881 | ** two arguments which are an integer and a pointer to an integer. The first |
| 2838 | 2882 | ** argument is 1, 0, or -1 to enable, disable, or leave unchanged the |
| 2839 | 2883 | ** reverse scan order flag, respectively. If the second argument is not NULL, |
| 2840 | 2884 | ** then 0 or 1 is written into the integer that the second argument points to |
| 2841 | 2885 | ** depending on if the reverse scan order flag is set after processing the |
| 2842 | 2886 | ** first argument. |
| 2843 | 2887 | ** </dd> |
| 2844 | 2888 | ** |
| 2889 | +** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]] |
| 2890 | +** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt> |
| 2891 | +** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables |
| 2892 | +** the ability of the [ATTACH DATABASE] SQL command to create a new database |
| 2893 | +** file if the database filed named in the ATTACH command does not already |
| 2894 | +** exist. This ability of ATTACH to create a new database is enabled by |
| 2895 | +** default. Applications can disable or reenable the ability for ATTACH to |
| 2896 | +** create new database files using this DBCONFIG option.<p> |
| 2897 | +** This option takes two arguments which are an integer and a pointer |
| 2898 | +** to an integer. The first argument is 1, 0, or -1 to enable, disable, or |
| 2899 | +** leave unchanged the attach-create flag, respectively. If the second |
| 2900 | +** argument is not NULL, then 0 or 1 is written into the integer that the |
| 2901 | +** second argument points to depending on if the attach-create flag is set |
| 2902 | +** after processing the first argument. |
| 2903 | +** </dd> |
| 2904 | +** |
| 2905 | +** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]] |
| 2906 | +** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt> |
| 2907 | +** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the |
| 2908 | +** ability of the [ATTACH DATABASE] SQL command to open a database for writing. |
| 2909 | +** This capability is enabled by default. Applications can disable or |
| 2910 | +** reenable this capability using the current DBCONFIG option. If the |
| 2911 | +** the this capability is disabled, the [ATTACH] command will still work, |
| 2912 | +** but the database will be opened read-only. If this option is disabled, |
| 2913 | +** then the ability to create a new database using [ATTACH] is also disabled, |
| 2914 | +** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE] |
| 2915 | +** option.<p> |
| 2916 | +** This option takes two arguments which are an integer and a pointer |
| 2917 | +** to an integer. The first argument is 1, 0, or -1 to enable, disable, or |
| 2918 | +** leave unchanged the ability to ATTACH another database for writing, |
| 2919 | +** respectively. If the second argument is not NULL, then 0 or 1 is written |
| 2920 | +** into the integer to which the second argument points, depending on whether |
| 2921 | +** the ability to ATTACH a read/write database is enabled or disabled |
| 2922 | +** after processing the first argument. |
| 2923 | +** </dd> |
| 2924 | +** |
| 2925 | +** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]] |
| 2926 | +** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt> |
| 2927 | +** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the |
| 2928 | +** ability to include comments in SQL text. Comments are enabled by default. |
| 2929 | +** An application can disable or reenable comments in SQL text using this |
| 2930 | +** DBCONFIG option.<p> |
| 2931 | +** This option takes two arguments which are an integer and a pointer |
| 2932 | +** to an integer. The first argument is 1, 0, or -1 to enable, disable, or |
| 2933 | +** leave unchanged the ability to use comments in SQL text, |
| 2934 | +** respectively. If the second argument is not NULL, then 0 or 1 is written |
| 2935 | +** into the integer that the second argument points to depending on if |
| 2936 | +** comments are allowed in SQL text after processing the first argument. |
| 2937 | +** </dd> |
| 2938 | +** |
| 2845 | 2939 | ** </dl> |
| 2940 | +** |
| 2941 | +** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3> |
| 2942 | +** |
| 2943 | +** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the |
| 2944 | +** overall call to [sqlite3_db_config()] has a total of four parameters. |
| 2945 | +** The first argument (the third parameter to sqlite3_db_config()) is a integer. |
| 2946 | +** The second argument is a pointer to an integer. If the first argument is 1, |
| 2947 | +** then the option becomes enabled. If the first integer argument is 0, then the |
| 2948 | +** option is disabled. If the first argument is -1, then the option setting |
| 2949 | +** is unchanged. The second argument, the pointer to an integer, may be NULL. |
| 2950 | +** If the second argument is not NULL, then a value of 0 or 1 is written into |
| 2951 | +** the integer to which the second argument points, depending on whether the |
| 2952 | +** setting is disabled or enabled after applying any changes specified by |
| 2953 | +** the first argument. |
| 2954 | +** |
| 2955 | +** <p>While most SQLITE_DBCONFIG options use the argument format |
| 2956 | +** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME] |
| 2957 | +** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the |
| 2958 | +** documentation of those exceptional options for details. |
| 2846 | 2959 | */ |
| 2847 | 2960 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 2848 | 2961 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 2849 | 2962 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| 2850 | 2963 | #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| | @@ -2862,11 +2975,14 @@ |
| 2862 | 2975 | #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ |
| 2863 | 2976 | #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ |
| 2864 | 2977 | #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */ |
| 2865 | 2978 | #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */ |
| 2866 | 2979 | #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */ |
| 2867 | | -#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */ |
| 2980 | +#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */ |
| 2981 | +#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */ |
| 2982 | +#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */ |
| 2983 | +#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */ |
| 2868 | 2984 | |
| 2869 | 2985 | /* |
| 2870 | 2986 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 2871 | 2987 | ** METHOD: sqlite3 |
| 2872 | 2988 | ** |
| | @@ -11065,12 +11181,13 @@ |
| 11065 | 11181 | SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb); |
| 11066 | 11182 | |
| 11067 | 11183 | /* |
| 11068 | 11184 | ** CAPI3REF: Serialize a database |
| 11069 | 11185 | ** |
| 11070 | | -** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory |
| 11071 | | -** that is a serialization of the S database on [database connection] D. |
| 11186 | +** The sqlite3_serialize(D,S,P,F) interface returns a pointer to |
| 11187 | +** memory that is a serialization of the S database on |
| 11188 | +** [database connection] D. If S is a NULL pointer, the main database is used. |
| 11072 | 11189 | ** If P is not a NULL pointer, then the size of the database in bytes |
| 11073 | 11190 | ** is written into *P. |
| 11074 | 11191 | ** |
| 11075 | 11192 | ** For an ordinary on-disk database file, the serialization is just a |
| 11076 | 11193 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| | @@ -12232,23 +12349,10 @@ |
| 12232 | 12349 | int nB, /* Number of bytes in buffer pB */ |
| 12233 | 12350 | void *pB, /* Pointer to buffer containing changeset B */ |
| 12234 | 12351 | int *pnOut, /* OUT: Number of bytes in output changeset */ |
| 12235 | 12352 | void **ppOut /* OUT: Buffer containing output changeset */ |
| 12236 | 12353 | ); |
| 12237 | | - |
| 12238 | | - |
| 12239 | | -/* |
| 12240 | | -** CAPI3REF: Upgrade the Schema of a Changeset/Patchset |
| 12241 | | -*/ |
| 12242 | | -SQLITE_API int sqlite3changeset_upgrade( |
| 12243 | | - sqlite3 *db, |
| 12244 | | - const char *zDb, |
| 12245 | | - int nIn, const void *pIn, /* Input changeset */ |
| 12246 | | - int *pnOut, void **ppOut /* OUT: Inverse of input */ |
| 12247 | | -); |
| 12248 | | - |
| 12249 | | - |
| 12250 | 12354 | |
| 12251 | 12355 | /* |
| 12252 | 12356 | ** CAPI3REF: Changegroup Handle |
| 12253 | 12357 | ** |
| 12254 | 12358 | ** A changegroup is an object used to combine two or more |
| | @@ -14046,13 +14150,17 @@ |
| 14046 | 14150 | # define SQLITE_MAX_VDBE_OP 250000000 |
| 14047 | 14151 | #endif |
| 14048 | 14152 | |
| 14049 | 14153 | /* |
| 14050 | 14154 | ** The maximum number of arguments to an SQL function. |
| 14155 | +** |
| 14156 | +** This value has a hard upper limit of 32767 due to storage |
| 14157 | +** constraints (it needs to fit inside a i16). We keep it |
| 14158 | +** lower than that to prevent abuse. |
| 14051 | 14159 | */ |
| 14052 | 14160 | #ifndef SQLITE_MAX_FUNCTION_ARG |
| 14053 | | -# define SQLITE_MAX_FUNCTION_ARG 127 |
| 14161 | +# define SQLITE_MAX_FUNCTION_ARG 1000 |
| 14054 | 14162 | #endif |
| 14055 | 14163 | |
| 14056 | 14164 | /* |
| 14057 | 14165 | ** The suggested maximum number of in-memory pages to use for |
| 14058 | 14166 | ** the main database table and for temporary tables. |
| | @@ -14648,10 +14756,11 @@ |
| 14648 | 14756 | */ |
| 14649 | 14757 | struct HashElem { |
| 14650 | 14758 | HashElem *next, *prev; /* Next and previous elements in the table */ |
| 14651 | 14759 | void *data; /* Data associated with this element */ |
| 14652 | 14760 | const char *pKey; /* Key associated with this element */ |
| 14761 | + unsigned int h; /* hash for pKey */ |
| 14653 | 14762 | }; |
| 14654 | 14763 | |
| 14655 | 14764 | /* |
| 14656 | 14765 | ** Access routines. To delete, insert a NULL pointer. |
| 14657 | 14766 | */ |
| | @@ -14871,11 +14980,12 @@ |
| 14871 | 14980 | #define TK_ASTERISK 180 |
| 14872 | 14981 | #define TK_SPAN 181 |
| 14873 | 14982 | #define TK_ERROR 182 |
| 14874 | 14983 | #define TK_QNUMBER 183 |
| 14875 | 14984 | #define TK_SPACE 184 |
| 14876 | | -#define TK_ILLEGAL 185 |
| 14985 | +#define TK_COMMENT 185 |
| 14986 | +#define TK_ILLEGAL 186 |
| 14877 | 14987 | |
| 14878 | 14988 | /************** End of parse.h ***********************************************/ |
| 14879 | 14989 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 14880 | 14990 | #include <stdio.h> |
| 14881 | 14991 | #include <stdlib.h> |
| | @@ -15085,10 +15195,15 @@ |
| 15085 | 15195 | typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ |
| 15086 | 15196 | typedef INT16_TYPE i16; /* 2-byte signed integer */ |
| 15087 | 15197 | typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ |
| 15088 | 15198 | typedef INT8_TYPE i8; /* 1-byte signed integer */ |
| 15089 | 15199 | |
| 15200 | +/* A bitfield type for use inside of structures. Always follow with :N where |
| 15201 | +** N is the number of bits. |
| 15202 | +*/ |
| 15203 | +typedef unsigned bft; /* Bit Field Type */ |
| 15204 | + |
| 15090 | 15205 | /* |
| 15091 | 15206 | ** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value |
| 15092 | 15207 | ** that can be stored in a u32 without loss of data. The value |
| 15093 | 15208 | ** is 0x00000000ffffffff. But because of quirks of some compilers, we |
| 15094 | 15209 | ** have to specify the value in the less intuitive manner shown: |
| | @@ -15123,10 +15238,12 @@ |
| 15123 | 15238 | ** Examples: |
| 15124 | 15239 | ** |
| 15125 | 15240 | ** 0.5 -> -10 0.1 -> -33 0.0625 -> -40 |
| 15126 | 15241 | */ |
| 15127 | 15242 | typedef INT16_TYPE LogEst; |
| 15243 | +#define LOGEST_MIN (-32768) |
| 15244 | +#define LOGEST_MAX (32767) |
| 15128 | 15245 | |
| 15129 | 15246 | /* |
| 15130 | 15247 | ** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer |
| 15131 | 15248 | */ |
| 15132 | 15249 | #ifndef SQLITE_PTRSIZE |
| | @@ -15251,10 +15368,18 @@ |
| 15251 | 15368 | */ |
| 15252 | 15369 | #define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) |
| 15253 | 15370 | #define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32)) |
| 15254 | 15371 | #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) |
| 15255 | 15372 | |
| 15373 | +/* |
| 15374 | +** Macro SMXV(n) return the maximum value that can be held in variable n, |
| 15375 | +** assuming n is a signed integer type. UMXV(n) is similar for unsigned |
| 15376 | +** integer types. |
| 15377 | +*/ |
| 15378 | +#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1) |
| 15379 | +#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1) |
| 15380 | + |
| 15256 | 15381 | /* |
| 15257 | 15382 | ** Round up a number to the next larger multiple of 8. This is used |
| 15258 | 15383 | ** to force 8-byte alignment on 64-bit architectures. |
| 15259 | 15384 | ** |
| 15260 | 15385 | ** ROUND8() always does the rounding, for any argument. |
| | @@ -15393,11 +15518,11 @@ |
| 15393 | 15518 | ** 0x-------F High-level debug messages |
| 15394 | 15519 | ** 0x----FFF- More detail |
| 15395 | 15520 | ** 0xFFFF---- Low-level debug messages |
| 15396 | 15521 | ** |
| 15397 | 15522 | ** 0x00000001 Code generation |
| 15398 | | -** 0x00000002 Solver |
| 15523 | +** 0x00000002 Solver (Use 0x40000 for less detail) |
| 15399 | 15524 | ** 0x00000004 Solver costs |
| 15400 | 15525 | ** 0x00000008 WhereLoop inserts |
| 15401 | 15526 | ** |
| 15402 | 15527 | ** 0x00000010 Display sqlite3_index_info xBestIndex calls |
| 15403 | 15528 | ** 0x00000020 Range an equality scan metrics |
| | @@ -15412,10 +15537,12 @@ |
| 15412 | 15537 | ** 0x00004000 Show all WHERE terms at key points |
| 15413 | 15538 | ** 0x00008000 Show the full SELECT statement at key places |
| 15414 | 15539 | ** |
| 15415 | 15540 | ** 0x00010000 Show more detail when printing WHERE terms |
| 15416 | 15541 | ** 0x00020000 Show WHERE terms returned from whereScanNext() |
| 15542 | +** 0x00040000 Solver overview messages |
| 15543 | +** 0x00080000 Star-query heuristic |
| 15417 | 15544 | */ |
| 15418 | 15545 | |
| 15419 | 15546 | |
| 15420 | 15547 | /* |
| 15421 | 15548 | ** An instance of the following structure is used to store the busy-handler |
| | @@ -16049,10 +16176,26 @@ |
| 16049 | 16176 | #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ |
| 16050 | 16177 | #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ |
| 16051 | 16178 | #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ |
| 16052 | 16179 | #define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ |
| 16053 | 16180 | #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ |
| 16181 | + |
| 16182 | +#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL) |
| 16183 | + |
| 16184 | +/* |
| 16185 | +** The argument to this macro is a file descriptor (type sqlite3_file*). |
| 16186 | +** Return 0 if it is not open, or non-zero (but not 1) if it is. |
| 16187 | +** |
| 16188 | +** This is so that expressions can be written as: |
| 16189 | +** |
| 16190 | +** if( isOpen(pPager->jfd) ){ ... |
| 16191 | +** |
| 16192 | +** instead of |
| 16193 | +** |
| 16194 | +** if( pPager->jfd->pMethods ){ ... |
| 16195 | +*/ |
| 16196 | +#define isOpen(pFd) ((pFd)->pMethods!=0) |
| 16054 | 16197 | |
| 16055 | 16198 | /* |
| 16056 | 16199 | ** Flags that make up the mask passed to sqlite3PagerGet(). |
| 16057 | 16200 | */ |
| 16058 | 16201 | #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ |
| | @@ -16688,10 +16831,11 @@ |
| 16688 | 16831 | ** A signature for a reusable subroutine that materializes the RHS of |
| 16689 | 16832 | ** an IN operator. |
| 16690 | 16833 | */ |
| 16691 | 16834 | struct SubrtnSig { |
| 16692 | 16835 | int selId; /* SELECT-id for the SELECT statement on the RHS */ |
| 16836 | + u8 bComplete; /* True if fully coded and available for reusable */ |
| 16693 | 16837 | char *zAff; /* Affinity of the overall IN expression */ |
| 16694 | 16838 | int iTable; /* Ephemeral table generated by the subroutine */ |
| 16695 | 16839 | int iAddr; /* Subroutine entry address */ |
| 16696 | 16840 | int regReturn; /* Register used to hold return address */ |
| 16697 | 16841 | }; |
| | @@ -18018,10 +18162,13 @@ |
| 18018 | 18162 | /* DELETE, or UPDATE and return */ |
| 18019 | 18163 | /* the count using a callback. */ |
| 18020 | 18164 | #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */ |
| 18021 | 18165 | #define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */ |
| 18022 | 18166 | #define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */ |
| 18167 | +#define SQLITE_AttachCreate HI(0x00010) /* ATTACH allowed to create new dbs */ |
| 18168 | +#define SQLITE_AttachWrite HI(0x00020) /* ATTACH allowed to open for write */ |
| 18169 | +#define SQLITE_Comments HI(0x00040) /* Enable SQL comments */ |
| 18023 | 18170 | |
| 18024 | 18171 | /* Flags used only if debugging */ |
| 18025 | 18172 | #ifdef SQLITE_DEBUG |
| 18026 | 18173 | #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */ |
| 18027 | 18174 | #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */ |
| | @@ -18077,10 +18224,11 @@ |
| 18077 | 18224 | #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */ |
| 18078 | 18225 | #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */ |
| 18079 | 18226 | #define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */ |
| 18080 | 18227 | #define SQLITE_OnePass 0x08000000 /* Single-pass DELETE and UPDATE */ |
| 18081 | 18228 | #define SQLITE_OrderBySubq 0x10000000 /* ORDER BY in subquery helps outer */ |
| 18229 | +#define SQLITE_StarQuery 0x20000000 /* Heurists for star queries */ |
| 18082 | 18230 | #define SQLITE_AllOpts 0xffffffff /* All optimizations */ |
| 18083 | 18231 | |
| 18084 | 18232 | /* |
| 18085 | 18233 | ** Macros for testing whether or not optimizations are enabled or disabled. |
| 18086 | 18234 | */ |
| | @@ -18113,11 +18261,11 @@ |
| 18113 | 18261 | ** |
| 18114 | 18262 | ** The u.pHash field is used by the global built-ins. The u.pDestructor |
| 18115 | 18263 | ** field is used by per-connection app-def functions. |
| 18116 | 18264 | */ |
| 18117 | 18265 | struct FuncDef { |
| 18118 | | - i8 nArg; /* Number of arguments. -1 means unlimited */ |
| 18266 | + i16 nArg; /* Number of arguments. -1 means unlimited */ |
| 18119 | 18267 | u32 funcFlags; /* Some combination of SQLITE_FUNC_* */ |
| 18120 | 18268 | void *pUserData; /* User data parameter */ |
| 18121 | 18269 | FuncDef *pNext; /* Next function with same name */ |
| 18122 | 18270 | void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */ |
| 18123 | 18271 | void (*xFinalize)(sqlite3_context*); /* Agg finalizer */ |
| | @@ -18606,10 +18754,11 @@ |
| 18606 | 18754 | VTable *p; /* List of VTable objects. */ |
| 18607 | 18755 | } vtab; |
| 18608 | 18756 | } u; |
| 18609 | 18757 | Trigger *pTrigger; /* List of triggers on this object */ |
| 18610 | 18758 | Schema *pSchema; /* Schema that contains this table */ |
| 18759 | + u8 aHx[16]; /* Column aHt[K%sizeof(aHt)] might have hash K */ |
| 18611 | 18760 | }; |
| 18612 | 18761 | |
| 18613 | 18762 | /* |
| 18614 | 18763 | ** Allowed values for Table.tabFlags. |
| 18615 | 18764 | ** |
| | @@ -19406,17 +19555,12 @@ |
| 19406 | 19555 | ** |
| 19407 | 19556 | ** If "a" is the k-th column of table "t", then IdList.a[0].idx==k. |
| 19408 | 19557 | */ |
| 19409 | 19558 | struct IdList { |
| 19410 | 19559 | int nId; /* Number of identifiers on the list */ |
| 19411 | | - u8 eU4; /* Which element of a.u4 is valid */ |
| 19412 | 19560 | struct IdList_item { |
| 19413 | 19561 | char *zName; /* Name of the identifier */ |
| 19414 | | - union { |
| 19415 | | - int idx; /* Index in some Table.aCol[] of a column named zName */ |
| 19416 | | - Expr *pExpr; /* Expr to implement a USING variable -- NOT USED */ |
| 19417 | | - } u4; |
| 19418 | 19562 | } a[1]; |
| 19419 | 19563 | }; |
| 19420 | 19564 | |
| 19421 | 19565 | /* |
| 19422 | 19566 | ** Allowed values for IdList.eType, which determines which value of the a.u4 |
| | @@ -20008,29 +20152,36 @@ |
| 20008 | 20152 | struct Parse { |
| 20009 | 20153 | sqlite3 *db; /* The main database structure */ |
| 20010 | 20154 | char *zErrMsg; /* An error message */ |
| 20011 | 20155 | Vdbe *pVdbe; /* An engine for executing database bytecode */ |
| 20012 | 20156 | int rc; /* Return code from execution */ |
| 20013 | | - u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */ |
| 20014 | | - u8 checkSchema; /* Causes schema cookie check after an error */ |
| 20157 | + LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ |
| 20015 | 20158 | u8 nested; /* Number of nested calls to the parser/code generator */ |
| 20016 | 20159 | u8 nTempReg; /* Number of temporary registers in aTempReg[] */ |
| 20017 | 20160 | u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ |
| 20018 | 20161 | u8 mayAbort; /* True if statement may throw an ABORT exception */ |
| 20019 | 20162 | u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ |
| 20020 | | - u8 okConstFactor; /* OK to factor out constants */ |
| 20021 | 20163 | u8 disableLookaside; /* Number of times lookaside has been disabled */ |
| 20022 | 20164 | u8 prepFlags; /* SQLITE_PREPARE_* flags */ |
| 20023 | 20165 | u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ |
| 20024 | | - u8 bHasWith; /* True if statement contains WITH */ |
| 20025 | 20166 | u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */ |
| 20167 | + u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ |
| 20168 | + u8 bReturning; /* Coding a RETURNING trigger */ |
| 20169 | + u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ |
| 20170 | + u8 disableTriggers; /* True to disable triggers */ |
| 20026 | 20171 | #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) |
| 20027 | 20172 | u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ |
| 20028 | 20173 | #endif |
| 20029 | 20174 | #ifdef SQLITE_DEBUG |
| 20030 | 20175 | u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */ |
| 20176 | + u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER) |
| 20177 | + ** and ALTER TABLE ADD COLUMN. */ |
| 20031 | 20178 | #endif |
| 20179 | + bft colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */ |
| 20180 | + bft bHasWith :1; /* True if statement contains WITH */ |
| 20181 | + bft okConstFactor :1; /* OK to factor out constants */ |
| 20182 | + bft checkSchema :1; /* Causes schema cookie check after an error */ |
| 20032 | 20183 | int nRangeReg; /* Size of the temporary register block */ |
| 20033 | 20184 | int iRangeReg; /* First register in temporary register block */ |
| 20034 | 20185 | int nErr; /* Number of errors seen */ |
| 20035 | 20186 | int nTab; /* Number of previously allocated VDBE cursors */ |
| 20036 | 20187 | int nMem; /* Number of memory cells used so far */ |
| | @@ -20041,16 +20192,13 @@ |
| 20041 | 20192 | int nLabelAlloc; /* Number of slots in aLabel */ |
| 20042 | 20193 | int *aLabel; /* Space to hold the labels */ |
| 20043 | 20194 | ExprList *pConstExpr;/* Constant expressions */ |
| 20044 | 20195 | IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */ |
| 20045 | 20196 | IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */ |
| 20046 | | - Token constraintName;/* Name of the constraint currently being parsed */ |
| 20047 | 20197 | yDbMask writeMask; /* Start a write transaction on these databases */ |
| 20048 | 20198 | yDbMask cookieMask; /* Bitmask of schema verified databases */ |
| 20049 | | - int regRowid; /* Register holding rowid of CREATE TABLE entry */ |
| 20050 | | - int regRoot; /* Register holding root page number for new objects */ |
| 20051 | | - int nMaxArg; /* Max args passed to user function by sub-program */ |
| 20199 | + int nMaxArg; /* Max args to xUpdate and xFilter vtab methods */ |
| 20052 | 20200 | int nSelect; /* Number of SELECT stmts. Counter for Select.selId */ |
| 20053 | 20201 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 20054 | 20202 | u32 nProgressSteps; /* xProgress steps taken during sqlite3_prepare() */ |
| 20055 | 20203 | #endif |
| 20056 | 20204 | #ifndef SQLITE_OMIT_SHARED_CACHE |
| | @@ -20060,21 +20208,10 @@ |
| 20060 | 20208 | AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ |
| 20061 | 20209 | Parse *pToplevel; /* Parse structure for main program (or NULL) */ |
| 20062 | 20210 | Table *pTriggerTab; /* Table triggers are being coded for */ |
| 20063 | 20211 | TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ |
| 20064 | 20212 | ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ |
| 20065 | | - union { |
| 20066 | | - int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ |
| 20067 | | - Returning *pReturning; /* The RETURNING clause */ |
| 20068 | | - } u1; |
| 20069 | | - u32 oldmask; /* Mask of old.* columns referenced */ |
| 20070 | | - u32 newmask; /* Mask of new.* columns referenced */ |
| 20071 | | - LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ |
| 20072 | | - u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ |
| 20073 | | - u8 bReturning; /* Coding a RETURNING trigger */ |
| 20074 | | - u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ |
| 20075 | | - u8 disableTriggers; /* True to disable triggers */ |
| 20076 | 20213 | |
| 20077 | 20214 | /************************************************************************** |
| 20078 | 20215 | ** Fields above must be initialized to zero. The fields that follow, |
| 20079 | 20216 | ** down to the beginning of the recursive section, do not need to be |
| 20080 | 20217 | ** initialized as they will be set before being used. The boundary is |
| | @@ -20082,10 +20219,23 @@ |
| 20082 | 20219 | **************************************************************************/ |
| 20083 | 20220 | |
| 20084 | 20221 | int aTempReg[8]; /* Holding area for temporary registers */ |
| 20085 | 20222 | Parse *pOuterParse; /* Outer Parse object when nested */ |
| 20086 | 20223 | Token sNameToken; /* Token with unqualified schema object name */ |
| 20224 | + u32 oldmask; /* Mask of old.* columns referenced */ |
| 20225 | + u32 newmask; /* Mask of new.* columns referenced */ |
| 20226 | + union { |
| 20227 | + struct { /* These fields available when isCreate is true */ |
| 20228 | + int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ |
| 20229 | + int regRowid; /* Register holding rowid of CREATE TABLE entry */ |
| 20230 | + int regRoot; /* Register holding root page for new objects */ |
| 20231 | + Token constraintName; /* Name of the constraint currently being parsed */ |
| 20232 | + } cr; |
| 20233 | + struct { /* These fields available to all other statements */ |
| 20234 | + Returning *pReturning; /* The RETURNING clause */ |
| 20235 | + } d; |
| 20236 | + } u1; |
| 20087 | 20237 | |
| 20088 | 20238 | /************************************************************************ |
| 20089 | 20239 | ** Above is constant between recursions. Below is reset before and after |
| 20090 | 20240 | ** each recursion. The boundary between these two regions is determined |
| 20091 | 20241 | ** using offsetof(Parse,sLastToken) so the sLastToken field must be the |
| | @@ -20099,13 +20249,11 @@ |
| 20099 | 20249 | u8 eParseMode; /* PARSE_MODE_XXX constant */ |
| 20100 | 20250 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 20101 | 20251 | int nVtabLock; /* Number of virtual tables to lock */ |
| 20102 | 20252 | #endif |
| 20103 | 20253 | int nHeight; /* Expression tree height of current sub-select */ |
| 20104 | | -#ifndef SQLITE_OMIT_EXPLAIN |
| 20105 | 20254 | int addrExplain; /* Address of current OP_Explain opcode */ |
| 20106 | | -#endif |
| 20107 | 20255 | VList *pVList; /* Mapping between variable names and numbers */ |
| 20108 | 20256 | Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 20109 | 20257 | const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 20110 | 20258 | Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 20111 | 20259 | Index *pNewIndex; /* An index being constructed by CREATE INDEX. |
| | @@ -23559,10 +23707,11 @@ |
| 23559 | 23707 | char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */ |
| 23560 | 23708 | void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */ |
| 23561 | 23709 | #ifdef SQLITE_DEBUG |
| 23562 | 23710 | Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ |
| 23563 | 23711 | u16 mScopyFlags; /* flags value immediately after the shallow copy */ |
| 23712 | + u8 bScopy; /* The pScopyFrom of some other Mem *might* point here */ |
| 23564 | 23713 | #endif |
| 23565 | 23714 | }; |
| 23566 | 23715 | |
| 23567 | 23716 | /* |
| 23568 | 23717 | ** Size of struct Mem not including the Mem.zMalloc member or anything that |
| | @@ -23708,18 +23857,14 @@ |
| 23708 | 23857 | Vdbe *pVdbe; /* The VM that owns this context */ |
| 23709 | 23858 | int iOp; /* Instruction number of OP_Function */ |
| 23710 | 23859 | int isError; /* Error code returned by the function. */ |
| 23711 | 23860 | u8 enc; /* Encoding to use for results */ |
| 23712 | 23861 | u8 skipFlag; /* Skip accumulator loading if true */ |
| 23713 | | - u8 argc; /* Number of arguments */ |
| 23862 | + u16 argc; /* Number of arguments */ |
| 23714 | 23863 | sqlite3_value *argv[1]; /* Argument set */ |
| 23715 | 23864 | }; |
| 23716 | 23865 | |
| 23717 | | -/* A bitfield type for use inside of structures. Always follow with :N where |
| 23718 | | -** N is the number of bits. |
| 23719 | | -*/ |
| 23720 | | -typedef unsigned bft; /* Bit Field Type */ |
| 23721 | 23866 | |
| 23722 | 23867 | /* The ScanStatus object holds a single value for the |
| 23723 | 23868 | ** sqlite3_stmt_scanstatus() interface. |
| 23724 | 23869 | ** |
| 23725 | 23870 | ** aAddrRange[]: |
| | @@ -23776,11 +23921,11 @@ |
| 23776 | 23921 | i64 iCurrentTime; /* Value of julianday('now') for this statement */ |
| 23777 | 23922 | i64 nFkConstraint; /* Number of imm. FK constraints this VM */ |
| 23778 | 23923 | i64 nStmtDefCons; /* Number of def. constraints when stmt started */ |
| 23779 | 23924 | i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */ |
| 23780 | 23925 | Mem *aMem; /* The memory locations */ |
| 23781 | | - Mem **apArg; /* Arguments to currently executing user function */ |
| 23926 | + Mem **apArg; /* Arguments xUpdate and xFilter vtab methods */ |
| 23782 | 23927 | VdbeCursor **apCsr; /* One element of this array for each open cursor */ |
| 23783 | 23928 | Mem *aVar; /* Values for the OP_Variable opcode. */ |
| 23784 | 23929 | |
| 23785 | 23930 | /* When allocating a new Vdbe object, all of the fields below should be |
| 23786 | 23931 | ** initialized to zero or NULL */ |
| | @@ -23796,10 +23941,11 @@ |
| 23796 | 23941 | i64 startTime; /* Time when query started - used for profiling */ |
| 23797 | 23942 | #endif |
| 23798 | 23943 | #ifdef SQLITE_DEBUG |
| 23799 | 23944 | int rcApp; /* errcode set by sqlite3_result_error_code() */ |
| 23800 | 23945 | u32 nWrite; /* Number of write operations that have occurred */ |
| 23946 | + int napArg; /* Size of the apArg[] array */ |
| 23801 | 23947 | #endif |
| 23802 | 23948 | u16 nResColumn; /* Number of columns in one row of the result set */ |
| 23803 | 23949 | u16 nResAlloc; /* Column slots allocated to aColName[] */ |
| 23804 | 23950 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 23805 | 23951 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| | @@ -24657,10 +24803,13 @@ |
| 24657 | 24803 | ms = ms*10.0 + *zDate - '0'; |
| 24658 | 24804 | rScale *= 10.0; |
| 24659 | 24805 | zDate++; |
| 24660 | 24806 | } |
| 24661 | 24807 | ms /= rScale; |
| 24808 | + /* Truncate to avoid problems with sub-milliseconds |
| 24809 | + ** rounding. https://sqlite.org/forum/forumpost/766a2c9231 */ |
| 24810 | + if( ms>0.999 ) ms = 0.999; |
| 24662 | 24811 | } |
| 24663 | 24812 | }else{ |
| 24664 | 24813 | s = 0; |
| 24665 | 24814 | } |
| 24666 | 24815 | p->validJD = 0; |
| | @@ -25864,11 +26013,11 @@ |
| 25864 | 26013 | sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D); |
| 25865 | 26014 | break; |
| 25866 | 26015 | } |
| 25867 | 26016 | case 'f': { /* Fractional seconds. (Non-standard) */ |
| 25868 | 26017 | double s = x.s; |
| 25869 | | - if( s>59.999 ) s = 59.999; |
| 26018 | + if( NEVER(s>59.999) ) s = 59.999; |
| 25870 | 26019 | sqlite3_str_appendf(&sRes, "%06.3f", s); |
| 25871 | 26020 | break; |
| 25872 | 26021 | } |
| 25873 | 26022 | case 'F': { |
| 25874 | 26023 | sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D); |
| | @@ -32424,11 +32573,11 @@ |
| 32424 | 32573 | ** pointer if any kind of error was encountered. |
| 32425 | 32574 | */ |
| 32426 | 32575 | static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ |
| 32427 | 32576 | char *zText; |
| 32428 | 32577 | assert( p->mxAlloc>0 && !isMalloced(p) ); |
| 32429 | | - zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); |
| 32578 | + zText = sqlite3DbMallocRaw(p->db, 1+(u64)p->nChar ); |
| 32430 | 32579 | if( zText ){ |
| 32431 | 32580 | memcpy(zText, p->zText, p->nChar+1); |
| 32432 | 32581 | p->printfFlags |= SQLITE_PRINTF_MALLOCED; |
| 32433 | 32582 | }else{ |
| 32434 | 32583 | sqlite3StrAccumSetError(p, SQLITE_NOMEM); |
| | @@ -33032,11 +33181,14 @@ |
| 33032 | 33181 | } |
| 33033 | 33182 | if( pItem->fg.fromDDL ){ |
| 33034 | 33183 | sqlite3_str_appendf(&x, " DDL"); |
| 33035 | 33184 | } |
| 33036 | 33185 | if( pItem->fg.isCte ){ |
| 33037 | | - sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse); |
| 33186 | + static const char *aMat[] = {",MAT", "", ",NO-MAT"}; |
| 33187 | + sqlite3_str_appendf(&x, " CteUse=%d%s", |
| 33188 | + pItem->u2.pCteUse->nUse, |
| 33189 | + aMat[pItem->u2.pCteUse->eM10d]); |
| 33038 | 33190 | } |
| 33039 | 33191 | if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){ |
| 33040 | 33192 | sqlite3_str_appendf(&x, " isOn"); |
| 33041 | 33193 | } |
| 33042 | 33194 | if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc"); |
| | @@ -33063,13 +33215,10 @@ |
| 33063 | 33215 | if( pItem->pSTab ){ |
| 33064 | 33216 | Table *pTab = pItem->pSTab; |
| 33065 | 33217 | sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1); |
| 33066 | 33218 | } |
| 33067 | 33219 | assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) ); |
| 33068 | | - sqlite3TreeViewPush(&pView, 0); |
| 33069 | | - sqlite3TreeViewLine(pView, "SUBQUERY"); |
| 33070 | | - sqlite3TreeViewPop(&pView); |
| 33071 | 33220 | sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0); |
| 33072 | 33221 | } |
| 33073 | 33222 | if( pItem->fg.isTabFunc ){ |
| 33074 | 33223 | sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); |
| 33075 | 33224 | } |
| | @@ -33795,25 +33944,11 @@ |
| 33795 | 33944 | char *zName = pList->a[i].zName; |
| 33796 | 33945 | int moreToFollow = i<pList->nId - 1; |
| 33797 | 33946 | if( zName==0 ) zName = "(null)"; |
| 33798 | 33947 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 33799 | 33948 | sqlite3TreeViewLine(pView, 0); |
| 33800 | | - if( pList->eU4==EU4_NONE ){ |
| 33801 | | - fprintf(stdout, "%s\n", zName); |
| 33802 | | - }else if( pList->eU4==EU4_IDX ){ |
| 33803 | | - fprintf(stdout, "%s (%d)\n", zName, pList->a[i].u4.idx); |
| 33804 | | - }else{ |
| 33805 | | - assert( pList->eU4==EU4_EXPR ); |
| 33806 | | - if( pList->a[i].u4.pExpr==0 ){ |
| 33807 | | - fprintf(stdout, "%s (pExpr=NULL)\n", zName); |
| 33808 | | - }else{ |
| 33809 | | - fprintf(stdout, "%s\n", zName); |
| 33810 | | - sqlite3TreeViewPush(&pView, i<pList->nId-1); |
| 33811 | | - sqlite3TreeViewExpr(pView, pList->a[i].u4.pExpr, 0); |
| 33812 | | - sqlite3TreeViewPop(&pView); |
| 33813 | | - } |
| 33814 | | - } |
| 33949 | + fprintf(stdout, "%s\n", zName); |
| 33815 | 33950 | sqlite3TreeViewPop(&pView); |
| 33816 | 33951 | } |
| 33817 | 33952 | } |
| 33818 | 33953 | } |
| 33819 | 33954 | SQLITE_PRIVATE void sqlite3TreeViewIdList( |
| | @@ -36290,11 +36425,15 @@ |
| 36290 | 36425 | } |
| 36291 | 36426 | } |
| 36292 | 36427 | } |
| 36293 | 36428 | p->z = &p->zBuf[i+1]; |
| 36294 | 36429 | assert( i+p->n < sizeof(p->zBuf) ); |
| 36295 | | - while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; } |
| 36430 | + assert( p->n>0 ); |
| 36431 | + while( p->z[p->n-1]=='0' ){ |
| 36432 | + p->n--; |
| 36433 | + assert( p->n>0 ); |
| 36434 | + } |
| 36296 | 36435 | } |
| 36297 | 36436 | |
| 36298 | 36437 | /* |
| 36299 | 36438 | ** Try to convert z into an unsigned 32-bit integer. Return true on |
| 36300 | 36439 | ** success and false if there is an error. |
| | @@ -37076,16 +37215,23 @@ |
| 37076 | 37215 | /* |
| 37077 | 37216 | ** The hashing function. |
| 37078 | 37217 | */ |
| 37079 | 37218 | static unsigned int strHash(const char *z){ |
| 37080 | 37219 | unsigned int h = 0; |
| 37081 | | - unsigned char c; |
| 37082 | | - while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/ |
| 37220 | + while( z[0] ){ /*OPTIMIZATION-IF-TRUE*/ |
| 37083 | 37221 | /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). |
| 37084 | 37222 | ** 0x9e3779b1 is 2654435761 which is the closest prime number to |
| 37085 | | - ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */ |
| 37086 | | - h += sqlite3UpperToLower[c]; |
| 37223 | + ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. |
| 37224 | + ** |
| 37225 | + ** Only bits 0xdf for ASCII and bits 0xbf for EBCDIC each octet are |
| 37226 | + ** hashed since the omitted bits determine the upper/lower case difference. |
| 37227 | + */ |
| 37228 | +#ifdef SQLITE_EBCDIC |
| 37229 | + h += 0xbf & (unsigned char)*(z++); |
| 37230 | +#else |
| 37231 | + h += 0xdf & (unsigned char)*(z++); |
| 37232 | +#endif |
| 37087 | 37233 | h *= 0x9e3779b1; |
| 37088 | 37234 | } |
| 37089 | 37235 | return h; |
| 37090 | 37236 | } |
| 37091 | 37237 | |
| | @@ -37154,13 +37300,12 @@ |
| 37154 | 37300 | sqlite3_free(pH->ht); |
| 37155 | 37301 | pH->ht = new_ht; |
| 37156 | 37302 | pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht); |
| 37157 | 37303 | memset(new_ht, 0, new_size*sizeof(struct _ht)); |
| 37158 | 37304 | for(elem=pH->first, pH->first=0; elem; elem = next_elem){ |
| 37159 | | - unsigned int h = strHash(elem->pKey) % new_size; |
| 37160 | 37305 | next_elem = elem->next; |
| 37161 | | - insertElement(pH, &new_ht[h], elem); |
| 37306 | + insertElement(pH, &new_ht[elem->h % new_size], elem); |
| 37162 | 37307 | } |
| 37163 | 37308 | return 1; |
| 37164 | 37309 | } |
| 37165 | 37310 | |
| 37166 | 37311 | /* This function (for internal use only) locates an element in an |
| | @@ -37174,27 +37319,26 @@ |
| 37174 | 37319 | unsigned int *pHash /* Write the hash value here */ |
| 37175 | 37320 | ){ |
| 37176 | 37321 | HashElem *elem; /* Used to loop thru the element list */ |
| 37177 | 37322 | unsigned int count; /* Number of elements left to test */ |
| 37178 | 37323 | unsigned int h; /* The computed hash */ |
| 37179 | | - static HashElem nullElement = { 0, 0, 0, 0 }; |
| 37324 | + static HashElem nullElement = { 0, 0, 0, 0, 0 }; |
| 37180 | 37325 | |
| 37326 | + h = strHash(pKey); |
| 37181 | 37327 | if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/ |
| 37182 | 37328 | struct _ht *pEntry; |
| 37183 | | - h = strHash(pKey) % pH->htsize; |
| 37184 | | - pEntry = &pH->ht[h]; |
| 37329 | + pEntry = &pH->ht[h % pH->htsize]; |
| 37185 | 37330 | elem = pEntry->chain; |
| 37186 | 37331 | count = pEntry->count; |
| 37187 | 37332 | }else{ |
| 37188 | | - h = 0; |
| 37189 | 37333 | elem = pH->first; |
| 37190 | 37334 | count = pH->count; |
| 37191 | 37335 | } |
| 37192 | 37336 | if( pHash ) *pHash = h; |
| 37193 | 37337 | while( count ){ |
| 37194 | 37338 | assert( elem!=0 ); |
| 37195 | | - if( sqlite3StrICmp(elem->pKey,pKey)==0 ){ |
| 37339 | + if( h==elem->h && sqlite3StrICmp(elem->pKey,pKey)==0 ){ |
| 37196 | 37340 | return elem; |
| 37197 | 37341 | } |
| 37198 | 37342 | elem = elem->next; |
| 37199 | 37343 | count--; |
| 37200 | 37344 | } |
| | @@ -37202,14 +37346,13 @@ |
| 37202 | 37346 | } |
| 37203 | 37347 | |
| 37204 | 37348 | /* Remove a single entry from the hash table given a pointer to that |
| 37205 | 37349 | ** element and a hash on the element's key. |
| 37206 | 37350 | */ |
| 37207 | | -static void removeElementGivenHash( |
| 37351 | +static void removeElement( |
| 37208 | 37352 | Hash *pH, /* The pH containing "elem" */ |
| 37209 | | - HashElem* elem, /* The element to be removed from the pH */ |
| 37210 | | - unsigned int h /* Hash value for the element */ |
| 37353 | + HashElem *elem /* The element to be removed from the pH */ |
| 37211 | 37354 | ){ |
| 37212 | 37355 | struct _ht *pEntry; |
| 37213 | 37356 | if( elem->prev ){ |
| 37214 | 37357 | elem->prev->next = elem->next; |
| 37215 | 37358 | }else{ |
| | @@ -37217,11 +37360,11 @@ |
| 37217 | 37360 | } |
| 37218 | 37361 | if( elem->next ){ |
| 37219 | 37362 | elem->next->prev = elem->prev; |
| 37220 | 37363 | } |
| 37221 | 37364 | if( pH->ht ){ |
| 37222 | | - pEntry = &pH->ht[h]; |
| 37365 | + pEntry = &pH->ht[elem->h % pH->htsize]; |
| 37223 | 37366 | if( pEntry->chain==elem ){ |
| 37224 | 37367 | pEntry->chain = elem->next; |
| 37225 | 37368 | } |
| 37226 | 37369 | assert( pEntry->count>0 ); |
| 37227 | 37370 | pEntry->count--; |
| | @@ -37268,11 +37411,11 @@ |
| 37268 | 37411 | assert( pKey!=0 ); |
| 37269 | 37412 | elem = findElementWithHash(pH,pKey,&h); |
| 37270 | 37413 | if( elem->data ){ |
| 37271 | 37414 | void *old_data = elem->data; |
| 37272 | 37415 | if( data==0 ){ |
| 37273 | | - removeElementGivenHash(pH,elem,h); |
| 37416 | + removeElement(pH,elem); |
| 37274 | 37417 | }else{ |
| 37275 | 37418 | elem->data = data; |
| 37276 | 37419 | elem->pKey = pKey; |
| 37277 | 37420 | } |
| 37278 | 37421 | return old_data; |
| | @@ -37279,19 +37422,17 @@ |
| 37279 | 37422 | } |
| 37280 | 37423 | if( data==0 ) return 0; |
| 37281 | 37424 | new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) ); |
| 37282 | 37425 | if( new_elem==0 ) return data; |
| 37283 | 37426 | new_elem->pKey = pKey; |
| 37427 | + new_elem->h = h; |
| 37284 | 37428 | new_elem->data = data; |
| 37285 | 37429 | pH->count++; |
| 37286 | | - if( pH->count>=10 && pH->count > 2*pH->htsize ){ |
| 37287 | | - if( rehash(pH, pH->count*2) ){ |
| 37288 | | - assert( pH->htsize>0 ); |
| 37289 | | - h = strHash(pKey) % pH->htsize; |
| 37290 | | - } |
| 37430 | + if( pH->count>=5 && pH->count > 2*pH->htsize ){ |
| 37431 | + rehash(pH, pH->count*3); |
| 37291 | 37432 | } |
| 37292 | | - insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem); |
| 37433 | + insertElement(pH, pH->ht ? &pH->ht[new_elem->h % pH->htsize] : 0, new_elem); |
| 37293 | 37434 | return 0; |
| 37294 | 37435 | } |
| 37295 | 37436 | |
| 37296 | 37437 | /************** End of hash.c ************************************************/ |
| 37297 | 37438 | /************** Begin file opcodes.c *****************************************/ |
| | @@ -40150,11 +40291,11 @@ |
| 40150 | 40291 | assert( pInode!=0 ); |
| 40151 | 40292 | assert( sqlite3_mutex_held(pInode->pLockMutex) ); |
| 40152 | 40293 | if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){ |
| 40153 | 40294 | if( pInode->bProcessLock==0 ){ |
| 40154 | 40295 | struct flock lock; |
| 40155 | | - assert( pInode->nLock==0 ); |
| 40296 | + /* assert( pInode->nLock==0 ); <-- Not true if unix-excl READONLY used */ |
| 40156 | 40297 | lock.l_whence = SEEK_SET; |
| 40157 | 40298 | lock.l_start = SHARED_FIRST; |
| 40158 | 40299 | lock.l_len = SHARED_SIZE; |
| 40159 | 40300 | lock.l_type = F_WRLCK; |
| 40160 | 40301 | rc = osSetPosixAdvisoryLock(pFile->h, &lock, pFile); |
| | @@ -50698,11 +50839,11 @@ |
| 50698 | 50839 | ** allocate space for a new winShmNode and filename. |
| 50699 | 50840 | */ |
| 50700 | 50841 | p = sqlite3MallocZero( sizeof(*p) ); |
| 50701 | 50842 | if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT; |
| 50702 | 50843 | nName = sqlite3Strlen30(pDbFd->zPath); |
| 50703 | | - pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); |
| 50844 | + pNew = sqlite3MallocZero( sizeof(*pShmNode) + (i64)nName + 17 ); |
| 50704 | 50845 | if( pNew==0 ){ |
| 50705 | 50846 | sqlite3_free(p); |
| 50706 | 50847 | return SQLITE_IOERR_NOMEM_BKPT; |
| 50707 | 50848 | } |
| 50708 | 50849 | pNew->zFilename = (char*)&pNew[1]; |
| | @@ -51519,11 +51660,11 @@ |
| 51519 | 51660 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 51520 | 51661 | "0123456789"; |
| 51521 | 51662 | size_t i, j; |
| 51522 | 51663 | DWORD pid; |
| 51523 | 51664 | int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX); |
| 51524 | | - int nMax, nBuf, nDir, nLen; |
| 51665 | + i64 nMax, nBuf, nDir, nLen; |
| 51525 | 51666 | char *zBuf; |
| 51526 | 51667 | |
| 51527 | 51668 | /* It's odd to simulate an io-error here, but really this is just |
| 51528 | 51669 | ** using the io-error infrastructure to test that SQLite handles this |
| 51529 | 51670 | ** function failing. |
| | @@ -51531,11 +51672,12 @@ |
| 51531 | 51672 | SimulateIOError( return SQLITE_IOERR ); |
| 51532 | 51673 | |
| 51533 | 51674 | /* Allocate a temporary buffer to store the fully qualified file |
| 51534 | 51675 | ** name for the temporary file. If this fails, we cannot continue. |
| 51535 | 51676 | */ |
| 51536 | | - nMax = pVfs->mxPathname; nBuf = nMax + 2; |
| 51677 | + nMax = pVfs->mxPathname; |
| 51678 | + nBuf = 2 + (i64)nMax; |
| 51537 | 51679 | zBuf = sqlite3MallocZero( nBuf ); |
| 51538 | 51680 | if( !zBuf ){ |
| 51539 | 51681 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 51540 | 51682 | return SQLITE_IOERR_NOMEM_BKPT; |
| 51541 | 51683 | } |
| | @@ -52390,11 +52532,11 @@ |
| 52390 | 52532 | ** NOTE: We are dealing with a relative path name and the data |
| 52391 | 52533 | ** directory has been set. Therefore, use it as the basis |
| 52392 | 52534 | ** for converting the relative path name to an absolute |
| 52393 | 52535 | ** one by prepending the data directory and a slash. |
| 52394 | 52536 | */ |
| 52395 | | - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); |
| 52537 | + char *zOut = sqlite3MallocZero( 1+(u64)pVfs->mxPathname ); |
| 52396 | 52538 | if( !zOut ){ |
| 52397 | 52539 | return SQLITE_IOERR_NOMEM_BKPT; |
| 52398 | 52540 | } |
| 52399 | 52541 | if( cygwin_conv_path( |
| 52400 | 52542 | (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) | |
| | @@ -52485,17 +52627,16 @@ |
| 52485 | 52627 | if( nByte==0 ){ |
| 52486 | 52628 | sqlite3_free(zConverted); |
| 52487 | 52629 | return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), |
| 52488 | 52630 | "winFullPathname1", zRelative); |
| 52489 | 52631 | } |
| 52490 | | - nByte += 3; |
| 52491 | | - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); |
| 52632 | + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); |
| 52492 | 52633 | if( zTemp==0 ){ |
| 52493 | 52634 | sqlite3_free(zConverted); |
| 52494 | 52635 | return SQLITE_IOERR_NOMEM_BKPT; |
| 52495 | 52636 | } |
| 52496 | | - nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); |
| 52637 | + nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte+3, zTemp, 0); |
| 52497 | 52638 | if( nByte==0 ){ |
| 52498 | 52639 | sqlite3_free(zConverted); |
| 52499 | 52640 | sqlite3_free(zTemp); |
| 52500 | 52641 | return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), |
| 52501 | 52642 | "winFullPathname2", zRelative); |
| | @@ -52511,17 +52652,16 @@ |
| 52511 | 52652 | if( nByte==0 ){ |
| 52512 | 52653 | sqlite3_free(zConverted); |
| 52513 | 52654 | return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), |
| 52514 | 52655 | "winFullPathname3", zRelative); |
| 52515 | 52656 | } |
| 52516 | | - nByte += 3; |
| 52517 | | - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); |
| 52657 | + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); |
| 52518 | 52658 | if( zTemp==0 ){ |
| 52519 | 52659 | sqlite3_free(zConverted); |
| 52520 | 52660 | return SQLITE_IOERR_NOMEM_BKPT; |
| 52521 | 52661 | } |
| 52522 | | - nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); |
| 52662 | + nByte = osGetFullPathNameA((char*)zConverted, nByte+3, zTemp, 0); |
| 52523 | 52663 | if( nByte==0 ){ |
| 52524 | 52664 | sqlite3_free(zConverted); |
| 52525 | 52665 | sqlite3_free(zTemp); |
| 52526 | 52666 | return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), |
| 52527 | 52667 | "winFullPathname4", zRelative); |
| | @@ -53546,17 +53686,17 @@ |
| 53546 | 53686 | break; |
| 53547 | 53687 | } |
| 53548 | 53688 | } |
| 53549 | 53689 | if( p==0 ){ |
| 53550 | 53690 | MemStore **apNew; |
| 53551 | | - p = sqlite3Malloc( sizeof(*p) + szName + 3 ); |
| 53691 | + p = sqlite3Malloc( sizeof(*p) + (i64)szName + 3 ); |
| 53552 | 53692 | if( p==0 ){ |
| 53553 | 53693 | sqlite3_mutex_leave(pVfsMutex); |
| 53554 | 53694 | return SQLITE_NOMEM; |
| 53555 | 53695 | } |
| 53556 | 53696 | apNew = sqlite3Realloc(memdb_g.apMemStore, |
| 53557 | | - sizeof(apNew[0])*(memdb_g.nMemStore+1) ); |
| 53697 | + sizeof(apNew[0])*(1+(i64)memdb_g.nMemStore) ); |
| 53558 | 53698 | if( apNew==0 ){ |
| 53559 | 53699 | sqlite3_free(p); |
| 53560 | 53700 | sqlite3_mutex_leave(pVfsMutex); |
| 53561 | 53701 | return SQLITE_NOMEM; |
| 53562 | 53702 | } |
| | @@ -54262,11 +54402,11 @@ |
| 54262 | 54402 | void *pTmpSpace; |
| 54263 | 54403 | |
| 54264 | 54404 | /* Allocate the Bitvec to be tested and a linear array of |
| 54265 | 54405 | ** bits to act as the reference */ |
| 54266 | 54406 | pBitvec = sqlite3BitvecCreate( sz ); |
| 54267 | | - pV = sqlite3MallocZero( (sz+7)/8 + 1 ); |
| 54407 | + pV = sqlite3MallocZero( (7+(i64)sz)/8 + 1 ); |
| 54268 | 54408 | pTmpSpace = sqlite3_malloc64(BITVEC_SZ); |
| 54269 | 54409 | if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end; |
| 54270 | 54410 | |
| 54271 | 54411 | /* NULL pBitvec tests */ |
| 54272 | 54412 | sqlite3BitvecSet(0, 1); |
| | @@ -55809,16 +55949,16 @@ |
| 55809 | 55949 | ** |
| 55810 | 55950 | ** The PCache mutex must be held when this function is called. |
| 55811 | 55951 | */ |
| 55812 | 55952 | static void pcache1ResizeHash(PCache1 *p){ |
| 55813 | 55953 | PgHdr1 **apNew; |
| 55814 | | - unsigned int nNew; |
| 55815 | | - unsigned int i; |
| 55954 | + u64 nNew; |
| 55955 | + u32 i; |
| 55816 | 55956 | |
| 55817 | 55957 | assert( sqlite3_mutex_held(p->pGroup->mutex) ); |
| 55818 | 55958 | |
| 55819 | | - nNew = p->nHash*2; |
| 55959 | + nNew = 2*(u64)p->nHash; |
| 55820 | 55960 | if( nNew<256 ){ |
| 55821 | 55961 | nNew = 256; |
| 55822 | 55962 | } |
| 55823 | 55963 | |
| 55824 | 55964 | pcache1LeaveMutex(p->pGroup); |
| | @@ -56037,11 +56177,11 @@ |
| 56037 | 56177 | ** Allocate a new cache. |
| 56038 | 56178 | */ |
| 56039 | 56179 | static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ |
| 56040 | 56180 | PCache1 *pCache; /* The newly created page cache */ |
| 56041 | 56181 | PGroup *pGroup; /* The group the new page cache will belong to */ |
| 56042 | | - int sz; /* Bytes of memory required to allocate the new cache */ |
| 56182 | + i64 sz; /* Bytes of memory required to allocate the new cache */ |
| 56043 | 56183 | |
| 56044 | 56184 | assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 ); |
| 56045 | 56185 | assert( szExtra < 300 ); |
| 56046 | 56186 | |
| 56047 | 56187 | sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache; |
| | @@ -58014,24 +58154,10 @@ |
| 58014 | 58154 | # define USEFETCH(x) ((x)->bUseFetch) |
| 58015 | 58155 | #else |
| 58016 | 58156 | # define USEFETCH(x) 0 |
| 58017 | 58157 | #endif |
| 58018 | 58158 | |
| 58019 | | -/* |
| 58020 | | -** The argument to this macro is a file descriptor (type sqlite3_file*). |
| 58021 | | -** Return 0 if it is not open, or non-zero (but not 1) if it is. |
| 58022 | | -** |
| 58023 | | -** This is so that expressions can be written as: |
| 58024 | | -** |
| 58025 | | -** if( isOpen(pPager->jfd) ){ ... |
| 58026 | | -** |
| 58027 | | -** instead of |
| 58028 | | -** |
| 58029 | | -** if( pPager->jfd->pMethods ){ ... |
| 58030 | | -*/ |
| 58031 | | -#define isOpen(pFd) ((pFd)->pMethods!=0) |
| 58032 | | - |
| 58033 | 58159 | #ifdef SQLITE_DIRECT_OVERFLOW_READ |
| 58034 | 58160 | /* |
| 58035 | 58161 | ** Return true if page pgno can be read directly from the database file |
| 58036 | 58162 | ** by the b-tree layer. This is the case if: |
| 58037 | 58163 | ** |
| | @@ -58047,11 +58173,11 @@ |
| 58047 | 58173 | if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; /* Failed (3) */ |
| 58048 | 58174 | #ifndef SQLITE_OMIT_WAL |
| 58049 | 58175 | if( pPager->pWal ){ |
| 58050 | 58176 | u32 iRead = 0; |
| 58051 | 58177 | (void)sqlite3WalFindFrame(pPager->pWal, pgno, &iRead); |
| 58052 | | - return iRead==0; /* Condition (4) */ |
| 58178 | + if( iRead ) return 0; /* Case (4) */ |
| 58053 | 58179 | } |
| 58054 | 58180 | #endif |
| 58055 | 58181 | assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 ); |
| 58056 | 58182 | if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd) |
| 58057 | 58183 | & SQLITE_IOCAP_SUBPAGE_READ)==0 ){ |
| | @@ -58530,11 +58656,11 @@ |
| 58530 | 58656 | ** zSuper[0] is set to 0 and SQLITE_OK returned. |
| 58531 | 58657 | ** |
| 58532 | 58658 | ** If an error occurs while reading from the journal file, an SQLite |
| 58533 | 58659 | ** error code is returned. |
| 58534 | 58660 | */ |
| 58535 | | -static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){ |
| 58661 | +static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u64 nSuper){ |
| 58536 | 58662 | int rc; /* Return code */ |
| 58537 | 58663 | u32 len; /* Length in bytes of super-journal name */ |
| 58538 | 58664 | i64 szJ; /* Total size in bytes of journal file pJrnl */ |
| 58539 | 58665 | u32 cksum; /* MJ checksum value read from journal */ |
| 58540 | 58666 | u32 u; /* Unsigned loop counter */ |
| | @@ -59313,11 +59439,11 @@ |
| 59313 | 59439 | rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); |
| 59314 | 59440 | } |
| 59315 | 59441 | } |
| 59316 | 59442 | pPager->journalOff = 0; |
| 59317 | 59443 | }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST |
| 59318 | | - || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL) |
| 59444 | + || (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL) |
| 59319 | 59445 | ){ |
| 59320 | 59446 | rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile); |
| 59321 | 59447 | pPager->journalOff = 0; |
| 59322 | 59448 | }else{ |
| 59323 | 59449 | /* This branch may be executed with Pager.journalMode==MEMORY if |
| | @@ -59766,16 +59892,16 @@ |
| 59766 | 59892 | char *zSuperJournal = 0; /* Contents of super-journal file */ |
| 59767 | 59893 | i64 nSuperJournal; /* Size of super-journal file */ |
| 59768 | 59894 | char *zJournal; /* Pointer to one journal within MJ file */ |
| 59769 | 59895 | char *zSuperPtr; /* Space to hold super-journal filename */ |
| 59770 | 59896 | char *zFree = 0; /* Free this buffer */ |
| 59771 | | - int nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ |
| 59897 | + i64 nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ |
| 59772 | 59898 | |
| 59773 | 59899 | /* Allocate space for both the pJournal and pSuper file descriptors. |
| 59774 | 59900 | ** If successful, open the super-journal file for reading. |
| 59775 | 59901 | */ |
| 59776 | | - pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); |
| 59902 | + pSuper = (sqlite3_file *)sqlite3MallocZero(2 * (i64)pVfs->szOsFile); |
| 59777 | 59903 | if( !pSuper ){ |
| 59778 | 59904 | rc = SQLITE_NOMEM_BKPT; |
| 59779 | 59905 | pJournal = 0; |
| 59780 | 59906 | }else{ |
| 59781 | 59907 | const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL); |
| | @@ -59789,15 +59915,18 @@ |
| 59789 | 59915 | ** sufficient space (in zSuperPtr) to hold the names of super-journal |
| 59790 | 59916 | ** files extracted from regular rollback-journals. |
| 59791 | 59917 | */ |
| 59792 | 59918 | rc = sqlite3OsFileSize(pSuper, &nSuperJournal); |
| 59793 | 59919 | if( rc!=SQLITE_OK ) goto delsuper_out; |
| 59794 | | - nSuperPtr = pVfs->mxPathname+1; |
| 59920 | + nSuperPtr = 1 + (i64)pVfs->mxPathname; |
| 59921 | + assert( nSuperJournal>=0 && nSuperPtr>0 ); |
| 59795 | 59922 | zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2); |
| 59796 | 59923 | if( !zFree ){ |
| 59797 | 59924 | rc = SQLITE_NOMEM_BKPT; |
| 59798 | 59925 | goto delsuper_out; |
| 59926 | + }else{ |
| 59927 | + assert( nSuperJournal<=0x7fffffff ); |
| 59799 | 59928 | } |
| 59800 | 59929 | zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0; |
| 59801 | 59930 | zSuperJournal = &zFree[4]; |
| 59802 | 59931 | zSuperPtr = &zSuperJournal[nSuperJournal+2]; |
| 59803 | 59932 | rc = sqlite3OsRead(pSuper, zSuperJournal, (int)nSuperJournal, 0); |
| | @@ -60054,11 +60183,11 @@ |
| 60054 | 60183 | ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c, |
| 60055 | 60184 | ** mxPathname is 512, which is the same as the minimum allowable value |
| 60056 | 60185 | ** for pageSize. |
| 60057 | 60186 | */ |
| 60058 | 60187 | zSuper = pPager->pTmpSpace; |
| 60059 | | - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); |
| 60188 | + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); |
| 60060 | 60189 | if( rc==SQLITE_OK && zSuper[0] ){ |
| 60061 | 60190 | rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res); |
| 60062 | 60191 | } |
| 60063 | 60192 | zSuper = 0; |
| 60064 | 60193 | if( rc!=SQLITE_OK || !res ){ |
| | @@ -60193,11 +60322,11 @@ |
| 60193 | 60322 | /* Leave 4 bytes of space before the super-journal filename in memory. |
| 60194 | 60323 | ** This is because it may end up being passed to sqlite3OsOpen(), in |
| 60195 | 60324 | ** which case it requires 4 0x00 bytes in memory immediately before |
| 60196 | 60325 | ** the filename. */ |
| 60197 | 60326 | zSuper = &pPager->pTmpSpace[4]; |
| 60198 | | - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); |
| 60327 | + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); |
| 60199 | 60328 | testcase( rc!=SQLITE_OK ); |
| 60200 | 60329 | } |
| 60201 | 60330 | if( rc==SQLITE_OK |
| 60202 | 60331 | && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) |
| 60203 | 60332 | ){ |
| | @@ -61963,10 +62092,11 @@ |
| 61963 | 62092 | int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */ |
| 61964 | 62093 | int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */ |
| 61965 | 62094 | u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ |
| 61966 | 62095 | const char *zUri = 0; /* URI args to copy */ |
| 61967 | 62096 | int nUriByte = 1; /* Number of bytes of URI args at *zUri */ |
| 62097 | + |
| 61968 | 62098 | |
| 61969 | 62099 | /* Figure out how much space is required for each journal file-handle |
| 61970 | 62100 | ** (there are two of them, the main journal and the sub-journal). */ |
| 61971 | 62101 | journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); |
| 61972 | 62102 | |
| | @@ -61989,12 +62119,12 @@ |
| 61989 | 62119 | ** to by zPathname, length nPathname. Or, if this is a temporary file, |
| 61990 | 62120 | ** leave both nPathname and zPathname set to 0. |
| 61991 | 62121 | */ |
| 61992 | 62122 | if( zFilename && zFilename[0] ){ |
| 61993 | 62123 | const char *z; |
| 61994 | | - nPathname = pVfs->mxPathname+1; |
| 61995 | | - zPathname = sqlite3DbMallocRaw(0, nPathname*2); |
| 62124 | + nPathname = pVfs->mxPathname + 1; |
| 62125 | + zPathname = sqlite3DbMallocRaw(0, 2*(i64)nPathname); |
| 61996 | 62126 | if( zPathname==0 ){ |
| 61997 | 62127 | return SQLITE_NOMEM_BKPT; |
| 61998 | 62128 | } |
| 61999 | 62129 | zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ |
| 62000 | 62130 | rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); |
| | @@ -62077,18 +62207,18 @@ |
| 62077 | 62207 | assert( SQLITE_PTRSIZE==sizeof(Pager*) ); |
| 62078 | 62208 | pPtr = (u8 *)sqlite3MallocZero( |
| 62079 | 62209 | ROUND8(sizeof(*pPager)) + /* Pager structure */ |
| 62080 | 62210 | ROUND8(pcacheSize) + /* PCache object */ |
| 62081 | 62211 | ROUND8(pVfs->szOsFile) + /* The main db file */ |
| 62082 | | - journalFileSize * 2 + /* The two journal files */ |
| 62212 | + (u64)journalFileSize * 2 + /* The two journal files */ |
| 62083 | 62213 | SQLITE_PTRSIZE + /* Space to hold a pointer */ |
| 62084 | 62214 | 4 + /* Database prefix */ |
| 62085 | | - nPathname + 1 + /* database filename */ |
| 62086 | | - nUriByte + /* query parameters */ |
| 62087 | | - nPathname + 8 + 1 + /* Journal filename */ |
| 62215 | + (u64)nPathname + 1 + /* database filename */ |
| 62216 | + (u64)nUriByte + /* query parameters */ |
| 62217 | + (u64)nPathname + 8 + 1 + /* Journal filename */ |
| 62088 | 62218 | #ifndef SQLITE_OMIT_WAL |
| 62089 | | - nPathname + 4 + 1 + /* WAL filename */ |
| 62219 | + (u64)nPathname + 4 + 1 + /* WAL filename */ |
| 62090 | 62220 | #endif |
| 62091 | 62221 | 3 /* Terminator */ |
| 62092 | 62222 | ); |
| 62093 | 62223 | assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) ); |
| 62094 | 62224 | if( !pPtr ){ |
| | @@ -65790,11 +65920,11 @@ |
| 65790 | 65920 | ){ |
| 65791 | 65921 | int rc = SQLITE_OK; |
| 65792 | 65922 | |
| 65793 | 65923 | /* Enlarge the pWal->apWiData[] array if required */ |
| 65794 | 65924 | if( pWal->nWiData<=iPage ){ |
| 65795 | | - sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); |
| 65925 | + sqlite3_int64 nByte = sizeof(u32*)*(1+(i64)iPage); |
| 65796 | 65926 | volatile u32 **apNew; |
| 65797 | 65927 | apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); |
| 65798 | 65928 | if( !apNew ){ |
| 65799 | 65929 | *ppPage = 0; |
| 65800 | 65930 | return SQLITE_NOMEM_BKPT; |
| | @@ -68023,15 +68153,11 @@ |
| 68023 | 68153 | ** so it takes care to hold an exclusive lock on the corresponding |
| 68024 | 68154 | ** WAL_READ_LOCK() while changing values. |
| 68025 | 68155 | */ |
| 68026 | 68156 | static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ |
| 68027 | 68157 | volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ |
| 68028 | | - u32 mxReadMark; /* Largest aReadMark[] value */ |
| 68029 | | - int mxI; /* Index of largest aReadMark[] value */ |
| 68030 | | - int i; /* Loop counter */ |
| 68031 | 68158 | int rc = SQLITE_OK; /* Return code */ |
| 68032 | | - u32 mxFrame; /* Wal frame to lock to */ |
| 68033 | 68159 | #ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68034 | 68160 | int nBlockTmout = 0; |
| 68035 | 68161 | #endif |
| 68036 | 68162 | |
| 68037 | 68163 | assert( pWal->readLock<0 ); /* Not currently locked */ |
| | @@ -68133,145 +68259,151 @@ |
| 68133 | 68259 | |
| 68134 | 68260 | assert( pWal->nWiData>0 ); |
| 68135 | 68261 | assert( pWal->apWiData[0]!=0 ); |
| 68136 | 68262 | pInfo = walCkptInfo(pWal); |
| 68137 | 68263 | SEH_INJECT_FAULT; |
| 68138 | | - if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame |
| 68139 | | -#ifdef SQLITE_ENABLE_SNAPSHOT |
| 68140 | | - && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) |
| 68141 | | -#endif |
| 68142 | | - ){ |
| 68143 | | - /* The WAL has been completely backfilled (or it is empty). |
| 68144 | | - ** and can be safely ignored. |
| 68145 | | - */ |
| 68146 | | - rc = walLockShared(pWal, WAL_READ_LOCK(0)); |
| 68147 | | - walShmBarrier(pWal); |
| 68148 | | - if( rc==SQLITE_OK ){ |
| 68149 | | - if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){ |
| 68150 | | - /* It is not safe to allow the reader to continue here if frames |
| 68151 | | - ** may have been appended to the log before READ_LOCK(0) was obtained. |
| 68152 | | - ** When holding READ_LOCK(0), the reader ignores the entire log file, |
| 68153 | | - ** which implies that the database file contains a trustworthy |
| 68154 | | - ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from |
| 68155 | | - ** happening, this is usually correct. |
| 68156 | | - ** |
| 68157 | | - ** However, if frames have been appended to the log (or if the log |
| 68158 | | - ** is wrapped and written for that matter) before the READ_LOCK(0) |
| 68159 | | - ** is obtained, that is not necessarily true. A checkpointer may |
| 68160 | | - ** have started to backfill the appended frames but crashed before |
| 68161 | | - ** it finished. Leaving a corrupt image in the database file. |
| 68162 | | - */ |
| 68163 | | - walUnlockShared(pWal, WAL_READ_LOCK(0)); |
| 68164 | | - return WAL_RETRY; |
| 68165 | | - } |
| 68166 | | - pWal->readLock = 0; |
| 68167 | | - return SQLITE_OK; |
| 68168 | | - }else if( rc!=SQLITE_BUSY ){ |
| 68169 | | - return rc; |
| 68170 | | - } |
| 68171 | | - } |
| 68172 | | - |
| 68173 | | - /* If we get this far, it means that the reader will want to use |
| 68174 | | - ** the WAL to get at content from recent commits. The job now is |
| 68175 | | - ** to select one of the aReadMark[] entries that is closest to |
| 68176 | | - ** but not exceeding pWal->hdr.mxFrame and lock that entry. |
| 68177 | | - */ |
| 68178 | | - mxReadMark = 0; |
| 68179 | | - mxI = 0; |
| 68180 | | - mxFrame = pWal->hdr.mxFrame; |
| 68181 | | -#ifdef SQLITE_ENABLE_SNAPSHOT |
| 68182 | | - if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ |
| 68183 | | - mxFrame = pWal->pSnapshot->mxFrame; |
| 68184 | | - } |
| 68185 | | -#endif |
| 68186 | | - for(i=1; i<WAL_NREADER; i++){ |
| 68187 | | - u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; |
| 68188 | | - if( mxReadMark<=thisMark && thisMark<=mxFrame ){ |
| 68189 | | - assert( thisMark!=READMARK_NOT_USED ); |
| 68190 | | - mxReadMark = thisMark; |
| 68191 | | - mxI = i; |
| 68192 | | - } |
| 68193 | | - } |
| 68194 | | - if( (pWal->readOnly & WAL_SHM_RDONLY)==0 |
| 68195 | | - && (mxReadMark<mxFrame || mxI==0) |
| 68196 | | - ){ |
| 68197 | | - for(i=1; i<WAL_NREADER; i++){ |
| 68198 | | - rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68199 | | - if( rc==SQLITE_OK ){ |
| 68200 | | - AtomicStore(pInfo->aReadMark+i,mxFrame); |
| 68201 | | - mxReadMark = mxFrame; |
| 68202 | | - mxI = i; |
| 68203 | | - walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68204 | | - break; |
| 68205 | | - }else if( rc!=SQLITE_BUSY ){ |
| 68206 | | - return rc; |
| 68207 | | - } |
| 68208 | | - } |
| 68209 | | - } |
| 68210 | | - if( mxI==0 ){ |
| 68211 | | - assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); |
| 68212 | | - return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; |
| 68213 | | - } |
| 68214 | | - |
| 68215 | | - (void)walEnableBlockingMs(pWal, nBlockTmout); |
| 68216 | | - rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68217 | | - walDisableBlocking(pWal); |
| 68218 | | - if( rc ){ |
| 68219 | | -#ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68220 | | - if( rc==SQLITE_BUSY_TIMEOUT ){ |
| 68221 | | - *pCnt |= WAL_RETRY_BLOCKED_MASK; |
| 68222 | | - } |
| 68223 | | -#else |
| 68224 | | - assert( rc!=SQLITE_BUSY_TIMEOUT ); |
| 68225 | | -#endif |
| 68226 | | - assert( (rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT ); |
| 68227 | | - return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; |
| 68228 | | - } |
| 68229 | | - /* Now that the read-lock has been obtained, check that neither the |
| 68230 | | - ** value in the aReadMark[] array or the contents of the wal-index |
| 68231 | | - ** header have changed. |
| 68232 | | - ** |
| 68233 | | - ** It is necessary to check that the wal-index header did not change |
| 68234 | | - ** between the time it was read and when the shared-lock was obtained |
| 68235 | | - ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility |
| 68236 | | - ** that the log file may have been wrapped by a writer, or that frames |
| 68237 | | - ** that occur later in the log than pWal->hdr.mxFrame may have been |
| 68238 | | - ** copied into the database by a checkpointer. If either of these things |
| 68239 | | - ** happened, then reading the database with the current value of |
| 68240 | | - ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry |
| 68241 | | - ** instead. |
| 68242 | | - ** |
| 68243 | | - ** Before checking that the live wal-index header has not changed |
| 68244 | | - ** since it was read, set Wal.minFrame to the first frame in the wal |
| 68245 | | - ** file that has not yet been checkpointed. This client will not need |
| 68246 | | - ** to read any frames earlier than minFrame from the wal file - they |
| 68247 | | - ** can be safely read directly from the database file. |
| 68248 | | - ** |
| 68249 | | - ** Because a ShmBarrier() call is made between taking the copy of |
| 68250 | | - ** nBackfill and checking that the wal-header in shared-memory still |
| 68251 | | - ** matches the one cached in pWal->hdr, it is guaranteed that the |
| 68252 | | - ** checkpointer that set nBackfill was not working with a wal-index |
| 68253 | | - ** header newer than that cached in pWal->hdr. If it were, that could |
| 68254 | | - ** cause a problem. The checkpointer could omit to checkpoint |
| 68255 | | - ** a version of page X that lies before pWal->minFrame (call that version |
| 68256 | | - ** A) on the basis that there is a newer version (version B) of the same |
| 68257 | | - ** page later in the wal file. But if version B happens to like past |
| 68258 | | - ** frame pWal->hdr.mxFrame - then the client would incorrectly assume |
| 68259 | | - ** that it can read version A from the database file. However, since |
| 68260 | | - ** we can guarantee that the checkpointer that set nBackfill could not |
| 68261 | | - ** see any pages past pWal->hdr.mxFrame, this problem does not come up. |
| 68262 | | - */ |
| 68263 | | - pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; |
| 68264 | | - walShmBarrier(pWal); |
| 68265 | | - if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark |
| 68266 | | - || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) |
| 68267 | | - ){ |
| 68268 | | - walUnlockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68269 | | - return WAL_RETRY; |
| 68270 | | - }else{ |
| 68271 | | - assert( mxReadMark<=pWal->hdr.mxFrame ); |
| 68272 | | - pWal->readLock = (i16)mxI; |
| 68264 | + { |
| 68265 | + u32 mxReadMark; /* Largest aReadMark[] value */ |
| 68266 | + int mxI; /* Index of largest aReadMark[] value */ |
| 68267 | + int i; /* Loop counter */ |
| 68268 | + u32 mxFrame; /* Wal frame to lock to */ |
| 68269 | + if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame |
| 68270 | +#ifdef SQLITE_ENABLE_SNAPSHOT |
| 68271 | + && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0) |
| 68272 | +#endif |
| 68273 | + ){ |
| 68274 | + /* The WAL has been completely backfilled (or it is empty). |
| 68275 | + ** and can be safely ignored. |
| 68276 | + */ |
| 68277 | + rc = walLockShared(pWal, WAL_READ_LOCK(0)); |
| 68278 | + walShmBarrier(pWal); |
| 68279 | + if( rc==SQLITE_OK ){ |
| 68280 | + if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr,sizeof(WalIndexHdr)) ){ |
| 68281 | + /* It is not safe to allow the reader to continue here if frames |
| 68282 | + ** may have been appended to the log before READ_LOCK(0) was obtained. |
| 68283 | + ** When holding READ_LOCK(0), the reader ignores the entire log file, |
| 68284 | + ** which implies that the database file contains a trustworthy |
| 68285 | + ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from |
| 68286 | + ** happening, this is usually correct. |
| 68287 | + ** |
| 68288 | + ** However, if frames have been appended to the log (or if the log |
| 68289 | + ** is wrapped and written for that matter) before the READ_LOCK(0) |
| 68290 | + ** is obtained, that is not necessarily true. A checkpointer may |
| 68291 | + ** have started to backfill the appended frames but crashed before |
| 68292 | + ** it finished. Leaving a corrupt image in the database file. |
| 68293 | + */ |
| 68294 | + walUnlockShared(pWal, WAL_READ_LOCK(0)); |
| 68295 | + return WAL_RETRY; |
| 68296 | + } |
| 68297 | + pWal->readLock = 0; |
| 68298 | + return SQLITE_OK; |
| 68299 | + }else if( rc!=SQLITE_BUSY ){ |
| 68300 | + return rc; |
| 68301 | + } |
| 68302 | + } |
| 68303 | + |
| 68304 | + /* If we get this far, it means that the reader will want to use |
| 68305 | + ** the WAL to get at content from recent commits. The job now is |
| 68306 | + ** to select one of the aReadMark[] entries that is closest to |
| 68307 | + ** but not exceeding pWal->hdr.mxFrame and lock that entry. |
| 68308 | + */ |
| 68309 | + mxReadMark = 0; |
| 68310 | + mxI = 0; |
| 68311 | + mxFrame = pWal->hdr.mxFrame; |
| 68312 | +#ifdef SQLITE_ENABLE_SNAPSHOT |
| 68313 | + if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ |
| 68314 | + mxFrame = pWal->pSnapshot->mxFrame; |
| 68315 | + } |
| 68316 | +#endif |
| 68317 | + for(i=1; i<WAL_NREADER; i++){ |
| 68318 | + u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT; |
| 68319 | + if( mxReadMark<=thisMark && thisMark<=mxFrame ){ |
| 68320 | + assert( thisMark!=READMARK_NOT_USED ); |
| 68321 | + mxReadMark = thisMark; |
| 68322 | + mxI = i; |
| 68323 | + } |
| 68324 | + } |
| 68325 | + if( (pWal->readOnly & WAL_SHM_RDONLY)==0 |
| 68326 | + && (mxReadMark<mxFrame || mxI==0) |
| 68327 | + ){ |
| 68328 | + for(i=1; i<WAL_NREADER; i++){ |
| 68329 | + rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68330 | + if( rc==SQLITE_OK ){ |
| 68331 | + AtomicStore(pInfo->aReadMark+i,mxFrame); |
| 68332 | + mxReadMark = mxFrame; |
| 68333 | + mxI = i; |
| 68334 | + walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 68335 | + break; |
| 68336 | + }else if( rc!=SQLITE_BUSY ){ |
| 68337 | + return rc; |
| 68338 | + } |
| 68339 | + } |
| 68340 | + } |
| 68341 | + if( mxI==0 ){ |
| 68342 | + assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); |
| 68343 | + return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; |
| 68344 | + } |
| 68345 | + |
| 68346 | + (void)walEnableBlockingMs(pWal, nBlockTmout); |
| 68347 | + rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68348 | + walDisableBlocking(pWal); |
| 68349 | + if( rc ){ |
| 68350 | +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT |
| 68351 | + if( rc==SQLITE_BUSY_TIMEOUT ){ |
| 68352 | + *pCnt |= WAL_RETRY_BLOCKED_MASK; |
| 68353 | + } |
| 68354 | +#else |
| 68355 | + assert( rc!=SQLITE_BUSY_TIMEOUT ); |
| 68356 | +#endif |
| 68357 | + assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT); |
| 68358 | + return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; |
| 68359 | + } |
| 68360 | + /* Now that the read-lock has been obtained, check that neither the |
| 68361 | + ** value in the aReadMark[] array or the contents of the wal-index |
| 68362 | + ** header have changed. |
| 68363 | + ** |
| 68364 | + ** It is necessary to check that the wal-index header did not change |
| 68365 | + ** between the time it was read and when the shared-lock was obtained |
| 68366 | + ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility |
| 68367 | + ** that the log file may have been wrapped by a writer, or that frames |
| 68368 | + ** that occur later in the log than pWal->hdr.mxFrame may have been |
| 68369 | + ** copied into the database by a checkpointer. If either of these things |
| 68370 | + ** happened, then reading the database with the current value of |
| 68371 | + ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry |
| 68372 | + ** instead. |
| 68373 | + ** |
| 68374 | + ** Before checking that the live wal-index header has not changed |
| 68375 | + ** since it was read, set Wal.minFrame to the first frame in the wal |
| 68376 | + ** file that has not yet been checkpointed. This client will not need |
| 68377 | + ** to read any frames earlier than minFrame from the wal file - they |
| 68378 | + ** can be safely read directly from the database file. |
| 68379 | + ** |
| 68380 | + ** Because a ShmBarrier() call is made between taking the copy of |
| 68381 | + ** nBackfill and checking that the wal-header in shared-memory still |
| 68382 | + ** matches the one cached in pWal->hdr, it is guaranteed that the |
| 68383 | + ** checkpointer that set nBackfill was not working with a wal-index |
| 68384 | + ** header newer than that cached in pWal->hdr. If it were, that could |
| 68385 | + ** cause a problem. The checkpointer could omit to checkpoint |
| 68386 | + ** a version of page X that lies before pWal->minFrame (call that version |
| 68387 | + ** A) on the basis that there is a newer version (version B) of the same |
| 68388 | + ** page later in the wal file. But if version B happens to like past |
| 68389 | + ** frame pWal->hdr.mxFrame - then the client would incorrectly assume |
| 68390 | + ** that it can read version A from the database file. However, since |
| 68391 | + ** we can guarantee that the checkpointer that set nBackfill could not |
| 68392 | + ** see any pages past pWal->hdr.mxFrame, this problem does not come up. |
| 68393 | + */ |
| 68394 | + pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT; |
| 68395 | + walShmBarrier(pWal); |
| 68396 | + if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark |
| 68397 | + || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) |
| 68398 | + ){ |
| 68399 | + walUnlockShared(pWal, WAL_READ_LOCK(mxI)); |
| 68400 | + return WAL_RETRY; |
| 68401 | + }else{ |
| 68402 | + assert( mxReadMark<=pWal->hdr.mxFrame ); |
| 68403 | + pWal->readLock = (i16)mxI; |
| 68404 | + } |
| 68273 | 68405 | } |
| 68274 | 68406 | return rc; |
| 68275 | 68407 | } |
| 68276 | 68408 | |
| 68277 | 68409 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| | @@ -71412,11 +71544,11 @@ |
| 71412 | 71544 | ** up to the size of 1 varint plus 1 8-byte value when the cursor |
| 71413 | 71545 | ** position is restored. Hence the 17 bytes of padding allocated |
| 71414 | 71546 | ** below. */ |
| 71415 | 71547 | void *pKey; |
| 71416 | 71548 | pCur->nKey = sqlite3BtreePayloadSize(pCur); |
| 71417 | | - pKey = sqlite3Malloc( pCur->nKey + 9 + 8 ); |
| 71549 | + pKey = sqlite3Malloc( ((i64)pCur->nKey) + 9 + 8 ); |
| 71418 | 71550 | if( pKey ){ |
| 71419 | 71551 | rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey); |
| 71420 | 71552 | if( rc==SQLITE_OK ){ |
| 71421 | 71553 | memset(((u8*)pKey)+pCur->nKey, 0, 9+8); |
| 71422 | 71554 | pCur->pKey = pKey; |
| | @@ -76783,11 +76915,11 @@ |
| 76783 | 76915 | testcase( nCell==2 ); /* Minimum legal index key size */ |
| 76784 | 76916 | if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){ |
| 76785 | 76917 | rc = SQLITE_CORRUPT_PAGE(pPage); |
| 76786 | 76918 | goto moveto_index_finish; |
| 76787 | 76919 | } |
| 76788 | | - pCellKey = sqlite3Malloc( nCell+nOverrun ); |
| 76920 | + pCellKey = sqlite3Malloc( (u64)nCell+(u64)nOverrun ); |
| 76789 | 76921 | if( pCellKey==0 ){ |
| 76790 | 76922 | rc = SQLITE_NOMEM_BKPT; |
| 76791 | 76923 | goto moveto_index_finish; |
| 76792 | 76924 | } |
| 76793 | 76925 | pCur->ix = (u16)idx; |
| | @@ -81972,10 +82104,11 @@ |
| 81972 | 82104 | ** blob of allocated memory. The xFree function should not call sqlite3_free() |
| 81973 | 82105 | ** on the memory, the btree layer does that. |
| 81974 | 82106 | */ |
| 81975 | 82107 | SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ |
| 81976 | 82108 | BtShared *pBt = p->pBt; |
| 82109 | + assert( nBytes==0 || nBytes==sizeof(Schema) ); |
| 81977 | 82110 | sqlite3BtreeEnter(p); |
| 81978 | 82111 | if( !pBt->pSchema && nBytes ){ |
| 81979 | 82112 | pBt->pSchema = sqlite3DbMallocZero(0, nBytes); |
| 81980 | 82113 | pBt->xFreeSchema = xFree; |
| 81981 | 82114 | } |
| | @@ -83274,11 +83407,11 @@ |
| 83274 | 83407 | if( (pMem->flags & (MEM_Str|MEM_Term|MEM_Ephem|MEM_Static))!=MEM_Str ){ |
| 83275 | 83408 | /* pMem must be a string, and it cannot be an ephemeral or static string */ |
| 83276 | 83409 | return; |
| 83277 | 83410 | } |
| 83278 | 83411 | if( pMem->enc!=SQLITE_UTF8 ) return; |
| 83279 | | - if( NEVER(pMem->z==0) ) return; |
| 83412 | + assert( pMem->z!=0 ); |
| 83280 | 83413 | if( pMem->flags & MEM_Dyn ){ |
| 83281 | 83414 | if( pMem->xDel==sqlite3_free |
| 83282 | 83415 | && sqlite3_msize(pMem->z) >= (u64)(pMem->n+1) |
| 83283 | 83416 | ){ |
| 83284 | 83417 | pMem->z[pMem->n] = 0; |
| | @@ -83993,31 +84126,34 @@ |
| 83993 | 84126 | ** copies (created by OP_SCopy) are not misused. |
| 83994 | 84127 | */ |
| 83995 | 84128 | SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ |
| 83996 | 84129 | int i; |
| 83997 | 84130 | Mem *pX; |
| 83998 | | - for(i=1, pX=pVdbe->aMem+1; i<pVdbe->nMem; i++, pX++){ |
| 83999 | | - if( pX->pScopyFrom==pMem ){ |
| 84000 | | - u16 mFlags; |
| 84001 | | - if( pVdbe->db->flags & SQLITE_VdbeTrace ){ |
| 84002 | | - sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n", |
| 84003 | | - (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem)); |
| 84004 | | - } |
| 84005 | | - /* If pX is marked as a shallow copy of pMem, then try to verify that |
| 84006 | | - ** no significant changes have been made to pX since the OP_SCopy. |
| 84007 | | - ** A significant change would indicated a missed call to this |
| 84008 | | - ** function for pX. Minor changes, such as adding or removing a |
| 84009 | | - ** dual type, are allowed, as long as the underlying value is the |
| 84010 | | - ** same. */ |
| 84011 | | - mFlags = pMem->flags & pX->flags & pX->mScopyFlags; |
| 84012 | | - assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i ); |
| 84013 | | - |
| 84014 | | - /* pMem is the register that is changing. But also mark pX as |
| 84015 | | - ** undefined so that we can quickly detect the shallow-copy error */ |
| 84016 | | - pX->flags = MEM_Undefined; |
| 84017 | | - pX->pScopyFrom = 0; |
| 84018 | | - } |
| 84131 | + if( pMem->bScopy ){ |
| 84132 | + for(i=1, pX=pVdbe->aMem+1; i<pVdbe->nMem; i++, pX++){ |
| 84133 | + if( pX->pScopyFrom==pMem ){ |
| 84134 | + u16 mFlags; |
| 84135 | + if( pVdbe->db->flags & SQLITE_VdbeTrace ){ |
| 84136 | + sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n", |
| 84137 | + (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem)); |
| 84138 | + } |
| 84139 | + /* If pX is marked as a shallow copy of pMem, then try to verify that |
| 84140 | + ** no significant changes have been made to pX since the OP_SCopy. |
| 84141 | + ** A significant change would indicated a missed call to this |
| 84142 | + ** function for pX. Minor changes, such as adding or removing a |
| 84143 | + ** dual type, are allowed, as long as the underlying value is the |
| 84144 | + ** same. */ |
| 84145 | + mFlags = pMem->flags & pX->flags & pX->mScopyFlags; |
| 84146 | + assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i ); |
| 84147 | + |
| 84148 | + /* pMem is the register that is changing. But also mark pX as |
| 84149 | + ** undefined so that we can quickly detect the shallow-copy error */ |
| 84150 | + pX->flags = MEM_Undefined; |
| 84151 | + pX->pScopyFrom = 0; |
| 84152 | + } |
| 84153 | + } |
| 84154 | + pMem->bScopy = 0; |
| 84019 | 84155 | } |
| 84020 | 84156 | pMem->pScopyFrom = 0; |
| 84021 | 84157 | } |
| 84022 | 84158 | #endif /* SQLITE_DEBUG */ |
| 84023 | 84159 | |
| | @@ -84384,11 +84520,11 @@ |
| 84384 | 84520 | if( p ){ |
| 84385 | 84521 | UnpackedRecord *pRec = p->ppRec[0]; |
| 84386 | 84522 | |
| 84387 | 84523 | if( pRec==0 ){ |
| 84388 | 84524 | Index *pIdx = p->pIdx; /* Index being probed */ |
| 84389 | | - int nByte; /* Bytes of space to allocate */ |
| 84525 | + i64 nByte; /* Bytes of space to allocate */ |
| 84390 | 84526 | int i; /* Counter variable */ |
| 84391 | 84527 | int nCol = pIdx->nColumn; /* Number of index columns including rowid */ |
| 84392 | 84528 | |
| 84393 | 84529 | nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord)); |
| 84394 | 84530 | pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte); |
| | @@ -84450,11 +84586,11 @@ |
| 84450 | 84586 | sqlite3_value **ppVal, /* Write the new value here */ |
| 84451 | 84587 | struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */ |
| 84452 | 84588 | ){ |
| 84453 | 84589 | sqlite3_context ctx; /* Context object for function invocation */ |
| 84454 | 84590 | sqlite3_value **apVal = 0; /* Function arguments */ |
| 84455 | | - int nVal = 0; /* Size of apVal[] array */ |
| 84591 | + int nVal = 0; /* Number of function arguments */ |
| 84456 | 84592 | FuncDef *pFunc = 0; /* Function definition */ |
| 84457 | 84593 | sqlite3_value *pVal = 0; /* New value */ |
| 84458 | 84594 | int rc = SQLITE_OK; /* Return code */ |
| 84459 | 84595 | ExprList *pList = 0; /* Function arguments */ |
| 84460 | 84596 | int i; /* Iterator variable */ |
| | @@ -85729,11 +85865,11 @@ |
| 85729 | 85865 | p->iSub++; |
| 85730 | 85866 | p->iAddr = 0; |
| 85731 | 85867 | } |
| 85732 | 85868 | |
| 85733 | 85869 | if( pRet->p4type==P4_SUBPROGRAM ){ |
| 85734 | | - int nByte = (p->nSub+1)*sizeof(SubProgram*); |
| 85870 | + i64 nByte = (1+(u64)p->nSub)*sizeof(SubProgram*); |
| 85735 | 85871 | int j; |
| 85736 | 85872 | for(j=0; j<p->nSub; j++){ |
| 85737 | 85873 | if( p->apSub[j]==pRet->p4.pProgram ) break; |
| 85738 | 85874 | } |
| 85739 | 85875 | if( j==p->nSub ){ |
| | @@ -85859,12 +85995,12 @@ |
| 85859 | 85995 | ** through all the opcodes and fixes up some details. |
| 85860 | 85996 | ** |
| 85861 | 85997 | ** (1) For each jump instruction with a negative P2 value (a label) |
| 85862 | 85998 | ** resolve the P2 value to an actual address. |
| 85863 | 85999 | ** |
| 85864 | | -** (2) Compute the maximum number of arguments used by any SQL function |
| 85865 | | -** and store that value in *pMaxFuncArgs. |
| 86000 | +** (2) Compute the maximum number of arguments used by the xUpdate/xFilter |
| 86001 | +** methods of any virtual table and store that value in *pMaxVtabArgs. |
| 85866 | 86002 | ** |
| 85867 | 86003 | ** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately |
| 85868 | 86004 | ** indicate what the prepared statement actually does. |
| 85869 | 86005 | ** |
| 85870 | 86006 | ** (4) (discontinued) |
| | @@ -85873,12 +86009,12 @@ |
| 85873 | 86009 | ** |
| 85874 | 86010 | ** This routine will only function correctly if the mkopcodeh.tcl generator |
| 85875 | 86011 | ** script numbers the opcodes correctly. Changes to this routine must be |
| 85876 | 86012 | ** coordinated with changes to mkopcodeh.tcl. |
| 85877 | 86013 | */ |
| 85878 | | -static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ |
| 85879 | | - int nMaxArgs = *pMaxFuncArgs; |
| 86014 | +static void resolveP2Values(Vdbe *p, int *pMaxVtabArgs){ |
| 86015 | + int nMaxVtabArgs = *pMaxVtabArgs; |
| 85880 | 86016 | Op *pOp; |
| 85881 | 86017 | Parse *pParse = p->pParse; |
| 85882 | 86018 | int *aLabel = pParse->aLabel; |
| 85883 | 86019 | |
| 85884 | 86020 | assert( pParse->db->mallocFailed==0 ); /* tag-20230419-1 */ |
| | @@ -85919,19 +86055,23 @@ |
| 85919 | 86055 | assert( pOp->p2>=0 ); |
| 85920 | 86056 | goto resolve_p2_values_loop_exit; |
| 85921 | 86057 | } |
| 85922 | 86058 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 85923 | 86059 | case OP_VUpdate: { |
| 85924 | | - if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2; |
| 86060 | + if( pOp->p2>nMaxVtabArgs ) nMaxVtabArgs = pOp->p2; |
| 85925 | 86061 | break; |
| 85926 | 86062 | } |
| 85927 | 86063 | case OP_VFilter: { |
| 85928 | 86064 | int n; |
| 86065 | + /* The instruction immediately prior to VFilter will be an |
| 86066 | + ** OP_Integer that sets the "argc" value for the VFilter. See |
| 86067 | + ** the code where OP_VFilter is generated at tag-20250207a. */ |
| 85929 | 86068 | assert( (pOp - p->aOp) >= 3 ); |
| 85930 | 86069 | assert( pOp[-1].opcode==OP_Integer ); |
| 86070 | + assert( pOp[-1].p2==pOp->p3+1 ); |
| 85931 | 86071 | n = pOp[-1].p1; |
| 85932 | | - if( n>nMaxArgs ) nMaxArgs = n; |
| 86072 | + if( n>nMaxVtabArgs ) nMaxVtabArgs = n; |
| 85933 | 86073 | /* Fall through into the default case */ |
| 85934 | 86074 | /* no break */ deliberate_fall_through |
| 85935 | 86075 | } |
| 85936 | 86076 | #endif |
| 85937 | 86077 | default: { |
| | @@ -85968,11 +86108,11 @@ |
| 85968 | 86108 | if( aLabel ){ |
| 85969 | 86109 | sqlite3DbNNFreeNN(p->db, pParse->aLabel); |
| 85970 | 86110 | pParse->aLabel = 0; |
| 85971 | 86111 | } |
| 85972 | 86112 | pParse->nLabel = 0; |
| 85973 | | - *pMaxFuncArgs = nMaxArgs; |
| 86113 | + *pMaxVtabArgs = nMaxVtabArgs; |
| 85974 | 86114 | assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) ); |
| 85975 | 86115 | } |
| 85976 | 86116 | |
| 85977 | 86117 | #ifdef SQLITE_DEBUG |
| 85978 | 86118 | /* |
| | @@ -86197,11 +86337,11 @@ |
| 86197 | 86337 | int addrVisit, /* Address of rows visited counter */ |
| 86198 | 86338 | LogEst nEst, /* Estimated number of output rows */ |
| 86199 | 86339 | const char *zName /* Name of table or index being scanned */ |
| 86200 | 86340 | ){ |
| 86201 | 86341 | if( IS_STMT_SCANSTATUS(p->db) ){ |
| 86202 | | - sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); |
| 86342 | + i64 nByte = (1+(i64)p->nScan) * sizeof(ScanStatus); |
| 86203 | 86343 | ScanStatus *aNew; |
| 86204 | 86344 | aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); |
| 86205 | 86345 | if( aNew ){ |
| 86206 | 86346 | ScanStatus *pNew = &aNew[p->nScan++]; |
| 86207 | 86347 | memset(pNew, 0, sizeof(ScanStatus)); |
| | @@ -87147,17 +87287,19 @@ |
| 87147 | 87287 | ** |
| 87148 | 87288 | ** All other fields of Mem can safely remain uninitialized for now. They |
| 87149 | 87289 | ** will be initialized before use. |
| 87150 | 87290 | */ |
| 87151 | 87291 | static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ |
| 87292 | + assert( db!=0 ); |
| 87152 | 87293 | if( N>0 ){ |
| 87153 | 87294 | do{ |
| 87154 | 87295 | p->flags = flags; |
| 87155 | 87296 | p->db = db; |
| 87156 | 87297 | p->szMalloc = 0; |
| 87157 | 87298 | #ifdef SQLITE_DEBUG |
| 87158 | 87299 | p->pScopyFrom = 0; |
| 87300 | + p->bScopy = 0; |
| 87159 | 87301 | #endif |
| 87160 | 87302 | p++; |
| 87161 | 87303 | }while( (--N)>0 ); |
| 87162 | 87304 | } |
| 87163 | 87305 | } |
| | @@ -87172,10 +87314,11 @@ |
| 87172 | 87314 | */ |
| 87173 | 87315 | static void releaseMemArray(Mem *p, int N){ |
| 87174 | 87316 | if( p && N ){ |
| 87175 | 87317 | Mem *pEnd = &p[N]; |
| 87176 | 87318 | sqlite3 *db = p->db; |
| 87319 | + assert( db!=0 ); |
| 87177 | 87320 | if( db->pnBytesFreed ){ |
| 87178 | 87321 | do{ |
| 87179 | 87322 | if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); |
| 87180 | 87323 | }while( (++p)<pEnd ); |
| 87181 | 87324 | return; |
| | @@ -87643,19 +87786,20 @@ |
| 87643 | 87786 | ){ |
| 87644 | 87787 | sqlite3 *db; /* The database connection */ |
| 87645 | 87788 | int nVar; /* Number of parameters */ |
| 87646 | 87789 | int nMem; /* Number of VM memory registers */ |
| 87647 | 87790 | int nCursor; /* Number of cursors required */ |
| 87648 | | - int nArg; /* Number of arguments in subprograms */ |
| 87791 | + int nArg; /* Max number args to xFilter or xUpdate */ |
| 87649 | 87792 | int n; /* Loop counter */ |
| 87650 | 87793 | struct ReusableSpace x; /* Reusable bulk memory */ |
| 87651 | 87794 | |
| 87652 | 87795 | assert( p!=0 ); |
| 87653 | 87796 | assert( p->nOp>0 ); |
| 87654 | 87797 | assert( pParse!=0 ); |
| 87655 | 87798 | assert( p->eVdbeState==VDBE_INIT_STATE ); |
| 87656 | 87799 | assert( pParse==p->pParse ); |
| 87800 | + assert( pParse->db==p->db ); |
| 87657 | 87801 | p->pVList = pParse->pVList; |
| 87658 | 87802 | pParse->pVList = 0; |
| 87659 | 87803 | db = p->db; |
| 87660 | 87804 | assert( db->mallocFailed==0 ); |
| 87661 | 87805 | nVar = pParse->nVar; |
| | @@ -87714,10 +87858,13 @@ |
| 87714 | 87858 | p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem)); |
| 87715 | 87859 | p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*)); |
| 87716 | 87860 | p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*)); |
| 87717 | 87861 | } |
| 87718 | 87862 | } |
| 87863 | +#ifdef SQLITE_DEBUG |
| 87864 | + p->napArg = nArg; |
| 87865 | +#endif |
| 87719 | 87866 | |
| 87720 | 87867 | if( db->mallocFailed ){ |
| 87721 | 87868 | p->nVar = 0; |
| 87722 | 87869 | p->nCursor = 0; |
| 87723 | 87870 | p->nMem = 0; |
| | @@ -89211,10 +89358,11 @@ |
| 89211 | 89358 | SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( |
| 89212 | 89359 | KeyInfo *pKeyInfo /* Description of the record */ |
| 89213 | 89360 | ){ |
| 89214 | 89361 | UnpackedRecord *p; /* Unpacked record to return */ |
| 89215 | 89362 | int nByte; /* Number of bytes required for *p */ |
| 89363 | + assert( sizeof(UnpackedRecord) + sizeof(Mem)*65536 < 0x7fffffff ); |
| 89216 | 89364 | nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1); |
| 89217 | 89365 | p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte); |
| 89218 | 89366 | if( !p ) return 0; |
| 89219 | 89367 | p->aMem = (Mem*)&((char*)p)[ROUND8P(sizeof(UnpackedRecord))]; |
| 89220 | 89368 | assert( pKeyInfo->aSortFlags!=0 ); |
| | @@ -90617,11 +90765,10 @@ |
| 90617 | 90765 | */ |
| 90618 | 90766 | static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ |
| 90619 | 90767 | sqlite3_int64 iNow; |
| 90620 | 90768 | sqlite3_int64 iElapse; |
| 90621 | 90769 | assert( p->startTime>0 ); |
| 90622 | | - assert( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 ); |
| 90623 | 90770 | assert( db->init.busy==0 ); |
| 90624 | 90771 | assert( p->zSql!=0 ); |
| 90625 | 90772 | sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); |
| 90626 | 90773 | iElapse = (iNow - p->startTime)*1000000; |
| 90627 | 90774 | #ifndef SQLITE_OMIT_DEPRECATED |
| | @@ -91337,11 +91484,11 @@ |
| 91337 | 91484 | if( db->nVdbeActive==0 ){ |
| 91338 | 91485 | AtomicStore(&db->u1.isInterrupted, 0); |
| 91339 | 91486 | } |
| 91340 | 91487 | |
| 91341 | 91488 | assert( db->nVdbeWrite>0 || db->autoCommit==0 |
| 91342 | | - || (db->nDeferredCons==0 && db->nDeferredImmCons==0) |
| 91489 | + || ((db->nDeferredCons + db->nDeferredImmCons)==0) |
| 91343 | 91490 | ); |
| 91344 | 91491 | |
| 91345 | 91492 | #ifndef SQLITE_OMIT_TRACE |
| 91346 | 91493 | if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 |
| 91347 | 91494 | && !db->init.busy && p->zSql ){ |
| | @@ -91848,10 +91995,11 @@ |
| 91848 | 91995 | /* .zMalloc = */ (char*)0, |
| 91849 | 91996 | /* .xDel = */ (void(*)(void*))0, |
| 91850 | 91997 | #ifdef SQLITE_DEBUG |
| 91851 | 91998 | /* .pScopyFrom = */ (Mem*)0, |
| 91852 | 91999 | /* .mScopyFlags= */ 0, |
| 92000 | + /* .bScopy = */ 0, |
| 91853 | 92001 | #endif |
| 91854 | 92002 | }; |
| 91855 | 92003 | return &nullMem; |
| 91856 | 92004 | } |
| 91857 | 92005 | |
| | @@ -91889,11 +92037,11 @@ |
| 91889 | 92037 | ** |
| 91890 | 92038 | ** sqlite3_column_int() |
| 91891 | 92039 | ** sqlite3_column_int64() |
| 91892 | 92040 | ** sqlite3_column_text() |
| 91893 | 92041 | ** sqlite3_column_text16() |
| 91894 | | -** sqlite3_column_real() |
| 92042 | +** sqlite3_column_double() |
| 91895 | 92043 | ** sqlite3_column_bytes() |
| 91896 | 92044 | ** sqlite3_column_bytes16() |
| 91897 | 92045 | ** sqlite3_column_blob() |
| 91898 | 92046 | */ |
| 91899 | 92047 | static void columnMallocFailure(sqlite3_stmt *pStmt) |
| | @@ -92730,10 +92878,11 @@ |
| 92730 | 92878 | */ |
| 92731 | 92879 | SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ |
| 92732 | 92880 | PreUpdate *p; |
| 92733 | 92881 | Mem *pMem; |
| 92734 | 92882 | int rc = SQLITE_OK; |
| 92883 | + int iStore = 0; |
| 92735 | 92884 | |
| 92736 | 92885 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 92737 | 92886 | if( db==0 || ppValue==0 ){ |
| 92738 | 92887 | return SQLITE_MISUSE_BKPT; |
| 92739 | 92888 | } |
| | @@ -92744,13 +92893,15 @@ |
| 92744 | 92893 | if( !p || p->op==SQLITE_INSERT ){ |
| 92745 | 92894 | rc = SQLITE_MISUSE_BKPT; |
| 92746 | 92895 | goto preupdate_old_out; |
| 92747 | 92896 | } |
| 92748 | 92897 | if( p->pPk ){ |
| 92749 | | - iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 92898 | + iStore = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 92899 | + }else{ |
| 92900 | + iStore = sqlite3TableColumnToStorage(p->pTab, iIdx); |
| 92750 | 92901 | } |
| 92751 | | - if( iIdx>=p->pCsr->nField || iIdx<0 ){ |
| 92902 | + if( iStore>=p->pCsr->nField || iStore<0 ){ |
| 92752 | 92903 | rc = SQLITE_RANGE; |
| 92753 | 92904 | goto preupdate_old_out; |
| 92754 | 92905 | } |
| 92755 | 92906 | |
| 92756 | 92907 | if( iIdx==p->pTab->iPKey ){ |
| | @@ -92777,18 +92928,20 @@ |
| 92777 | 92928 | goto preupdate_old_out; |
| 92778 | 92929 | } |
| 92779 | 92930 | p->aRecord = aRec; |
| 92780 | 92931 | } |
| 92781 | 92932 | |
| 92782 | | - pMem = *ppValue = &p->pUnpacked->aMem[iIdx]; |
| 92783 | | - if( iIdx>=p->pUnpacked->nField ){ |
| 92933 | + pMem = *ppValue = &p->pUnpacked->aMem[iStore]; |
| 92934 | + if( iStore>=p->pUnpacked->nField ){ |
| 92784 | 92935 | /* This occurs when the table has been extended using ALTER TABLE |
| 92785 | 92936 | ** ADD COLUMN. The value to return is the default value of the column. */ |
| 92786 | 92937 | Column *pCol = &p->pTab->aCol[iIdx]; |
| 92787 | 92938 | if( pCol->iDflt>0 ){ |
| 92788 | 92939 | if( p->apDflt==0 ){ |
| 92789 | | - int nByte = sizeof(sqlite3_value*)*p->pTab->nCol; |
| 92940 | + int nByte; |
| 92941 | + assert( sizeof(sqlite3_value*)*UMXV(p->pTab->nCol) < 0x7fffffff ); |
| 92942 | + nByte = sizeof(sqlite3_value*)*p->pTab->nCol; |
| 92790 | 92943 | p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte); |
| 92791 | 92944 | if( p->apDflt==0 ) goto preupdate_old_out; |
| 92792 | 92945 | } |
| 92793 | 92946 | if( p->apDflt[iIdx]==0 ){ |
| 92794 | 92947 | sqlite3_value *pVal = 0; |
| | @@ -92882,10 +93035,11 @@ |
| 92882 | 93035 | */ |
| 92883 | 93036 | SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ |
| 92884 | 93037 | PreUpdate *p; |
| 92885 | 93038 | int rc = SQLITE_OK; |
| 92886 | 93039 | Mem *pMem; |
| 93040 | + int iStore = 0; |
| 92887 | 93041 | |
| 92888 | 93042 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 92889 | 93043 | if( db==0 || ppValue==0 ){ |
| 92890 | 93044 | return SQLITE_MISUSE_BKPT; |
| 92891 | 93045 | } |
| | @@ -92894,13 +93048,16 @@ |
| 92894 | 93048 | if( !p || p->op==SQLITE_DELETE ){ |
| 92895 | 93049 | rc = SQLITE_MISUSE_BKPT; |
| 92896 | 93050 | goto preupdate_new_out; |
| 92897 | 93051 | } |
| 92898 | 93052 | if( p->pPk && p->op!=SQLITE_UPDATE ){ |
| 92899 | | - iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 93053 | + iStore = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 93054 | + }else{ |
| 93055 | + iStore = sqlite3TableColumnToStorage(p->pTab, iIdx); |
| 92900 | 93056 | } |
| 92901 | | - if( iIdx>=p->pCsr->nField || iIdx<0 ){ |
| 93057 | + |
| 93058 | + if( iStore>=p->pCsr->nField || iStore<0 ){ |
| 92902 | 93059 | rc = SQLITE_RANGE; |
| 92903 | 93060 | goto preupdate_new_out; |
| 92904 | 93061 | } |
| 92905 | 93062 | |
| 92906 | 93063 | if( p->op==SQLITE_INSERT ){ |
| | @@ -92916,37 +93073,38 @@ |
| 92916 | 93073 | rc = SQLITE_NOMEM; |
| 92917 | 93074 | goto preupdate_new_out; |
| 92918 | 93075 | } |
| 92919 | 93076 | p->pNewUnpacked = pUnpack; |
| 92920 | 93077 | } |
| 92921 | | - pMem = &pUnpack->aMem[iIdx]; |
| 93078 | + pMem = &pUnpack->aMem[iStore]; |
| 92922 | 93079 | if( iIdx==p->pTab->iPKey ){ |
| 92923 | 93080 | sqlite3VdbeMemSetInt64(pMem, p->iKey2); |
| 92924 | | - }else if( iIdx>=pUnpack->nField ){ |
| 93081 | + }else if( iStore>=pUnpack->nField ){ |
| 92925 | 93082 | pMem = (sqlite3_value *)columnNullValue(); |
| 92926 | 93083 | } |
| 92927 | 93084 | }else{ |
| 92928 | | - /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required |
| 93085 | + /* For an UPDATE, memory cell (p->iNewReg+1+iStore) contains the required |
| 92929 | 93086 | ** value. Make a copy of the cell contents and return a pointer to it. |
| 92930 | 93087 | ** It is not safe to return a pointer to the memory cell itself as the |
| 92931 | 93088 | ** caller may modify the value text encoding. |
| 92932 | 93089 | */ |
| 92933 | 93090 | assert( p->op==SQLITE_UPDATE ); |
| 92934 | 93091 | if( !p->aNew ){ |
| 92935 | | - p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField); |
| 93092 | + assert( sizeof(Mem)*UMXV(p->pCsr->nField) < 0x7fffffff ); |
| 93093 | + p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem)*p->pCsr->nField); |
| 92936 | 93094 | if( !p->aNew ){ |
| 92937 | 93095 | rc = SQLITE_NOMEM; |
| 92938 | 93096 | goto preupdate_new_out; |
| 92939 | 93097 | } |
| 92940 | 93098 | } |
| 92941 | | - assert( iIdx>=0 && iIdx<p->pCsr->nField ); |
| 92942 | | - pMem = &p->aNew[iIdx]; |
| 93099 | + assert( iStore>=0 && iStore<p->pCsr->nField ); |
| 93100 | + pMem = &p->aNew[iStore]; |
| 92943 | 93101 | if( pMem->flags==0 ){ |
| 92944 | 93102 | if( iIdx==p->pTab->iPKey ){ |
| 92945 | 93103 | sqlite3VdbeMemSetInt64(pMem, p->iKey2); |
| 92946 | 93104 | }else{ |
| 92947 | | - rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]); |
| 93105 | + rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iStore]); |
| 92948 | 93106 | if( rc!=SQLITE_OK ) goto preupdate_new_out; |
| 92949 | 93107 | } |
| 92950 | 93108 | } |
| 92951 | 93109 | } |
| 92952 | 93110 | *ppValue = pMem; |
| | @@ -93700,11 +93858,11 @@ |
| 93700 | 93858 | ** the top of the register space. Cursor 1 is at Mem[p->nMem-1]. |
| 93701 | 93859 | ** Cursor 2 is at Mem[p->nMem-2]. And so forth. |
| 93702 | 93860 | */ |
| 93703 | 93861 | Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem; |
| 93704 | 93862 | |
| 93705 | | - int nByte; |
| 93863 | + i64 nByte; |
| 93706 | 93864 | VdbeCursor *pCx = 0; |
| 93707 | 93865 | nByte = |
| 93708 | 93866 | ROUND8P(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + |
| 93709 | 93867 | (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0); |
| 93710 | 93868 | |
| | @@ -93728,11 +93886,11 @@ |
| 93728 | 93886 | pMem->z = pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, nByte); |
| 93729 | 93887 | if( pMem->zMalloc==0 ){ |
| 93730 | 93888 | pMem->szMalloc = 0; |
| 93731 | 93889 | return 0; |
| 93732 | 93890 | } |
| 93733 | | - pMem->szMalloc = nByte; |
| 93891 | + pMem->szMalloc = (int)nByte; |
| 93734 | 93892 | } |
| 93735 | 93893 | |
| 93736 | 93894 | p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; |
| 93737 | 93895 | memset(pCx, 0, offsetof(VdbeCursor,pAltCursor)); |
| 93738 | 93896 | pCx->eCurType = eCurType; |
| | @@ -94031,10 +94189,11 @@ |
| 94031 | 94189 | } |
| 94032 | 94190 | static void registerTrace(int iReg, Mem *p){ |
| 94033 | 94191 | printf("R[%d] = ", iReg); |
| 94034 | 94192 | memTracePrint(p); |
| 94035 | 94193 | if( p->pScopyFrom ){ |
| 94194 | + assert( p->pScopyFrom->bScopy ); |
| 94036 | 94195 | printf(" <== R[%d]", (int)(p->pScopyFrom - &p[-iReg])); |
| 94037 | 94196 | } |
| 94038 | 94197 | printf("\n"); |
| 94039 | 94198 | sqlite3VdbeCheckMemInvariants(p); |
| 94040 | 94199 | } |
| | @@ -95014,10 +95173,11 @@ |
| 95014 | 95173 | #ifdef SQLITE_DEBUG |
| 95015 | 95174 | pIn1->pScopyFrom = 0; |
| 95016 | 95175 | { int i; |
| 95017 | 95176 | for(i=1; i<p->nMem; i++){ |
| 95018 | 95177 | if( aMem[i].pScopyFrom==pIn1 ){ |
| 95178 | + assert( aMem[i].bScopy ); |
| 95019 | 95179 | aMem[i].pScopyFrom = pOut; |
| 95020 | 95180 | } |
| 95021 | 95181 | } |
| 95022 | 95182 | } |
| 95023 | 95183 | #endif |
| | @@ -95086,10 +95246,11 @@ |
| 95086 | 95246 | assert( pOut!=pIn1 ); |
| 95087 | 95247 | sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); |
| 95088 | 95248 | #ifdef SQLITE_DEBUG |
| 95089 | 95249 | pOut->pScopyFrom = pIn1; |
| 95090 | 95250 | pOut->mScopyFlags = pIn1->flags; |
| 95251 | + pIn1->bScopy = 1; |
| 95091 | 95252 | #endif |
| 95092 | 95253 | break; |
| 95093 | 95254 | } |
| 95094 | 95255 | |
| 95095 | 95256 | /* Opcode: IntCopy P1 P2 * * * |
| | @@ -100746,11 +100907,11 @@ |
| 100746 | 100907 | ** |
| 100747 | 100908 | ** If P5 is non-zero, then recursive program invocation is enabled. |
| 100748 | 100909 | */ |
| 100749 | 100910 | case OP_Program: { /* jump0 */ |
| 100750 | 100911 | int nMem; /* Number of memory registers for sub-program */ |
| 100751 | | - int nByte; /* Bytes of runtime space required for sub-program */ |
| 100912 | + i64 nByte; /* Bytes of runtime space required for sub-program */ |
| 100752 | 100913 | Mem *pRt; /* Register to allocate runtime space */ |
| 100753 | 100914 | Mem *pMem; /* Used to iterate through memory cells */ |
| 100754 | 100915 | Mem *pEnd; /* Last memory cell in new array */ |
| 100755 | 100916 | VdbeFrame *pFrame; /* New vdbe frame to execute in */ |
| 100756 | 100917 | SubProgram *pProgram; /* Sub-program to execute */ |
| | @@ -100797,19 +100958,19 @@ |
| 100797 | 100958 | assert( nMem>0 ); |
| 100798 | 100959 | if( pProgram->nCsr==0 ) nMem++; |
| 100799 | 100960 | nByte = ROUND8(sizeof(VdbeFrame)) |
| 100800 | 100961 | + nMem * sizeof(Mem) |
| 100801 | 100962 | + pProgram->nCsr * sizeof(VdbeCursor*) |
| 100802 | | - + (pProgram->nOp + 7)/8; |
| 100963 | + + (7 + (i64)pProgram->nOp)/8; |
| 100803 | 100964 | pFrame = sqlite3DbMallocZero(db, nByte); |
| 100804 | 100965 | if( !pFrame ){ |
| 100805 | 100966 | goto no_mem; |
| 100806 | 100967 | } |
| 100807 | 100968 | sqlite3VdbeMemRelease(pRt); |
| 100808 | 100969 | pRt->flags = MEM_Blob|MEM_Dyn; |
| 100809 | 100970 | pRt->z = (char*)pFrame; |
| 100810 | | - pRt->n = nByte; |
| 100971 | + pRt->n = (int)nByte; |
| 100811 | 100972 | pRt->xDel = sqlite3VdbeFrameMemDel; |
| 100812 | 100973 | |
| 100813 | 100974 | pFrame->v = p; |
| 100814 | 100975 | pFrame->nChildMem = nMem; |
| 100815 | 100976 | pFrame->nChildCsr = pProgram->nCsr; |
| | @@ -100904,16 +101065,18 @@ |
| 100904 | 101065 | ** If P1 is non-zero, the database constraint counter is incremented |
| 100905 | 101066 | ** (deferred foreign key constraints). Otherwise, if P1 is zero, the |
| 100906 | 101067 | ** statement counter is incremented (immediate foreign key constraints). |
| 100907 | 101068 | */ |
| 100908 | 101069 | case OP_FkCounter: { |
| 100909 | | - if( db->flags & SQLITE_DeferFKs ){ |
| 100910 | | - db->nDeferredImmCons += pOp->p2; |
| 100911 | | - }else if( pOp->p1 ){ |
| 101070 | + if( pOp->p1 ){ |
| 100912 | 101071 | db->nDeferredCons += pOp->p2; |
| 100913 | 101072 | }else{ |
| 100914 | | - p->nFkConstraint += pOp->p2; |
| 101073 | + if( db->flags & SQLITE_DeferFKs ){ |
| 101074 | + db->nDeferredImmCons += pOp->p2; |
| 101075 | + }else{ |
| 101076 | + p->nFkConstraint += pOp->p2; |
| 101077 | + } |
| 100915 | 101078 | } |
| 100916 | 101079 | break; |
| 100917 | 101080 | } |
| 100918 | 101081 | |
| 100919 | 101082 | /* Opcode: FkIfZero P1 P2 * * * |
| | @@ -101784,10 +101947,11 @@ |
| 101784 | 101947 | nArg = (int)pArgc->u.i; |
| 101785 | 101948 | iQuery = (int)pQuery->u.i; |
| 101786 | 101949 | |
| 101787 | 101950 | /* Invoke the xFilter method */ |
| 101788 | 101951 | apArg = p->apArg; |
| 101952 | + assert( nArg<=p->napArg ); |
| 101789 | 101953 | for(i = 0; i<nArg; i++){ |
| 101790 | 101954 | apArg[i] = &pArgc[i+1]; |
| 101791 | 101955 | } |
| 101792 | 101956 | rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg); |
| 101793 | 101957 | sqlite3VtabImportErrmsg(p, pVtab); |
| | @@ -101994,10 +102158,11 @@ |
| 101994 | 102158 | assert( pOp->p4type==P4_VTAB ); |
| 101995 | 102159 | if( ALWAYS(pModule->xUpdate) ){ |
| 101996 | 102160 | u8 vtabOnConflict = db->vtabOnConflict; |
| 101997 | 102161 | apArg = p->apArg; |
| 101998 | 102162 | pX = &aMem[pOp->p3]; |
| 102163 | + assert( nArg<=p->napArg ); |
| 101999 | 102164 | for(i=0; i<nArg; i++){ |
| 102000 | 102165 | assert( memIsValid(pX) ); |
| 102001 | 102166 | memAboutToChange(p, pX); |
| 102002 | 102167 | apArg[i] = pX; |
| 102003 | 102168 | pX++; |
| | @@ -102839,16 +103004,12 @@ |
| 102839 | 103004 | } |
| 102840 | 103005 | pBlob->pTab = pTab; |
| 102841 | 103006 | pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName; |
| 102842 | 103007 | |
| 102843 | 103008 | /* Now search pTab for the exact column. */ |
| 102844 | | - for(iCol=0; iCol<pTab->nCol; iCol++) { |
| 102845 | | - if( sqlite3StrICmp(pTab->aCol[iCol].zCnName, zColumn)==0 ){ |
| 102846 | | - break; |
| 102847 | | - } |
| 102848 | | - } |
| 102849 | | - if( iCol==pTab->nCol ){ |
| 103009 | + iCol = sqlite3ColumnIndex(pTab, zColumn); |
| 103010 | + if( iCol<0 ){ |
| 102850 | 103011 | sqlite3DbFree(db, zErr); |
| 102851 | 103012 | zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn); |
| 102852 | 103013 | rc = SQLITE_ERROR; |
| 102853 | 103014 | sqlite3BtreeLeaveAll(db); |
| 102854 | 103015 | goto blob_open_out; |
| | @@ -104106,11 +104267,11 @@ |
| 104106 | 104267 | int pgsz; /* Page size of main database */ |
| 104107 | 104268 | int i; /* Used to iterate through aTask[] */ |
| 104108 | 104269 | VdbeSorter *pSorter; /* The new sorter */ |
| 104109 | 104270 | KeyInfo *pKeyInfo; /* Copy of pCsr->pKeyInfo with db==0 */ |
| 104110 | 104271 | int szKeyInfo; /* Size of pCsr->pKeyInfo in bytes */ |
| 104111 | | - int sz; /* Size of pSorter in bytes */ |
| 104272 | + i64 sz; /* Size of pSorter in bytes */ |
| 104112 | 104273 | int rc = SQLITE_OK; |
| 104113 | 104274 | #if SQLITE_MAX_WORKER_THREADS==0 |
| 104114 | 104275 | # define nWorker 0 |
| 104115 | 104276 | #else |
| 104116 | 104277 | int nWorker; |
| | @@ -104134,10 +104295,12 @@ |
| 104134 | 104295 | #endif |
| 104135 | 104296 | |
| 104136 | 104297 | assert( pCsr->pKeyInfo ); |
| 104137 | 104298 | assert( !pCsr->isEphemeral ); |
| 104138 | 104299 | assert( pCsr->eCurType==CURTYPE_SORTER ); |
| 104300 | + assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*) |
| 104301 | + < 0x7fffffff ); |
| 104139 | 104302 | szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); |
| 104140 | 104303 | sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); |
| 104141 | 104304 | |
| 104142 | 104305 | pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo); |
| 104143 | 104306 | pCsr->uc.pSorter = pSorter; |
| | @@ -104347,11 +104510,11 @@ |
| 104347 | 104510 | ** nReader is automatically rounded up to the next power of two. |
| 104348 | 104511 | ** nReader may not exceed SORTER_MAX_MERGE_COUNT even after rounding up. |
| 104349 | 104512 | */ |
| 104350 | 104513 | static MergeEngine *vdbeMergeEngineNew(int nReader){ |
| 104351 | 104514 | int N = 2; /* Smallest power of two >= nReader */ |
| 104352 | | - int nByte; /* Total bytes of space to allocate */ |
| 104515 | + i64 nByte; /* Total bytes of space to allocate */ |
| 104353 | 104516 | MergeEngine *pNew; /* Pointer to allocated object to return */ |
| 104354 | 104517 | |
| 104355 | 104518 | assert( nReader<=SORTER_MAX_MERGE_COUNT ); |
| 104356 | 104519 | |
| 104357 | 104520 | while( N<nReader ) N += N; |
| | @@ -107390,11 +107553,10 @@ |
| 107390 | 107553 | SrcItem *pMatch = 0; /* The matching pSrcList item */ |
| 107391 | 107554 | NameContext *pTopNC = pNC; /* First namecontext in the list */ |
| 107392 | 107555 | Schema *pSchema = 0; /* Schema of the expression */ |
| 107393 | 107556 | int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */ |
| 107394 | 107557 | Table *pTab = 0; /* Table holding the row */ |
| 107395 | | - Column *pCol; /* A column of pTab */ |
| 107396 | 107558 | ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */ |
| 107397 | 107559 | const char *zCol = pRight->u.zToken; |
| 107398 | 107560 | |
| 107399 | 107561 | assert( pNC ); /* the name context cannot be NULL. */ |
| 107400 | 107562 | assert( zCol ); /* The Z in X.Y.Z cannot be NULL */ |
| | @@ -107441,11 +107603,10 @@ |
| 107441 | 107603 | ExprList *pEList; |
| 107442 | 107604 | SrcList *pSrcList = pNC->pSrcList; |
| 107443 | 107605 | |
| 107444 | 107606 | if( pSrcList ){ |
| 107445 | 107607 | for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){ |
| 107446 | | - u8 hCol; |
| 107447 | 107608 | pTab = pItem->pSTab; |
| 107448 | 107609 | assert( pTab!=0 && pTab->zName!=0 ); |
| 107449 | 107610 | assert( pTab->nCol>0 || pParse->nErr ); |
| 107450 | 107611 | assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem)); |
| 107451 | 107612 | if( pItem->fg.isNestedFrom ){ |
| | @@ -107529,47 +107690,42 @@ |
| 107529 | 107690 | assert( ExprUseYTab(pExpr) ); |
| 107530 | 107691 | if( IN_RENAME_OBJECT && pItem->zAlias ){ |
| 107531 | 107692 | sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab); |
| 107532 | 107693 | } |
| 107533 | 107694 | } |
| 107534 | | - hCol = sqlite3StrIHash(zCol); |
| 107535 | | - for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){ |
| 107536 | | - if( pCol->hName==hCol |
| 107537 | | - && sqlite3StrICmp(pCol->zCnName, zCol)==0 |
| 107538 | | - ){ |
| 107539 | | - if( cnt>0 ){ |
| 107540 | | - if( pItem->fg.isUsing==0 |
| 107541 | | - || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 |
| 107542 | | - ){ |
| 107543 | | - /* Two or more tables have the same column name which is |
| 107544 | | - ** not joined by USING. This is an error. Signal as much |
| 107545 | | - ** by clearing pFJMatch and letting cnt go above 1. */ |
| 107546 | | - sqlite3ExprListDelete(db, pFJMatch); |
| 107547 | | - pFJMatch = 0; |
| 107548 | | - }else |
| 107549 | | - if( (pItem->fg.jointype & JT_RIGHT)==0 ){ |
| 107550 | | - /* An INNER or LEFT JOIN. Use the left-most table */ |
| 107551 | | - continue; |
| 107552 | | - }else |
| 107553 | | - if( (pItem->fg.jointype & JT_LEFT)==0 ){ |
| 107554 | | - /* A RIGHT JOIN. Use the right-most table */ |
| 107555 | | - cnt = 0; |
| 107556 | | - sqlite3ExprListDelete(db, pFJMatch); |
| 107557 | | - pFJMatch = 0; |
| 107558 | | - }else{ |
| 107559 | | - /* For a FULL JOIN, we must construct a coalesce() func */ |
| 107560 | | - extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); |
| 107561 | | - } |
| 107562 | | - } |
| 107563 | | - cnt++; |
| 107564 | | - pMatch = pItem; |
| 107565 | | - /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ |
| 107566 | | - pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j; |
| 107567 | | - if( pItem->fg.isNestedFrom ){ |
| 107568 | | - sqlite3SrcItemColumnUsed(pItem, j); |
| 107569 | | - } |
| 107570 | | - break; |
| 107695 | + j = sqlite3ColumnIndex(pTab, zCol); |
| 107696 | + if( j>=0 ){ |
| 107697 | + if( cnt>0 ){ |
| 107698 | + if( pItem->fg.isUsing==0 |
| 107699 | + || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 |
| 107700 | + ){ |
| 107701 | + /* Two or more tables have the same column name which is |
| 107702 | + ** not joined by USING. This is an error. Signal as much |
| 107703 | + ** by clearing pFJMatch and letting cnt go above 1. */ |
| 107704 | + sqlite3ExprListDelete(db, pFJMatch); |
| 107705 | + pFJMatch = 0; |
| 107706 | + }else |
| 107707 | + if( (pItem->fg.jointype & JT_RIGHT)==0 ){ |
| 107708 | + /* An INNER or LEFT JOIN. Use the left-most table */ |
| 107709 | + continue; |
| 107710 | + }else |
| 107711 | + if( (pItem->fg.jointype & JT_LEFT)==0 ){ |
| 107712 | + /* A RIGHT JOIN. Use the right-most table */ |
| 107713 | + cnt = 0; |
| 107714 | + sqlite3ExprListDelete(db, pFJMatch); |
| 107715 | + pFJMatch = 0; |
| 107716 | + }else{ |
| 107717 | + /* For a FULL JOIN, we must construct a coalesce() func */ |
| 107718 | + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); |
| 107719 | + } |
| 107720 | + } |
| 107721 | + cnt++; |
| 107722 | + pMatch = pItem; |
| 107723 | + /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ |
| 107724 | + pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j; |
| 107725 | + if( pItem->fg.isNestedFrom ){ |
| 107726 | + sqlite3SrcItemColumnUsed(pItem, j); |
| 107571 | 107727 | } |
| 107572 | 107728 | } |
| 107573 | 107729 | if( 0==cnt && VisibleRowid(pTab) ){ |
| 107574 | 107730 | /* pTab is a potential ROWID match. Keep track of it and match |
| 107575 | 107731 | ** the ROWID later if that seems appropriate. (Search for "cntTab" |
| | @@ -107655,26 +107811,21 @@ |
| 107655 | 107811 | } |
| 107656 | 107812 | #endif /* SQLITE_OMIT_UPSERT */ |
| 107657 | 107813 | |
| 107658 | 107814 | if( pTab ){ |
| 107659 | 107815 | int iCol; |
| 107660 | | - u8 hCol = sqlite3StrIHash(zCol); |
| 107661 | 107816 | pSchema = pTab->pSchema; |
| 107662 | 107817 | cntTab++; |
| 107663 | | - for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){ |
| 107664 | | - if( pCol->hName==hCol |
| 107665 | | - && sqlite3StrICmp(pCol->zCnName, zCol)==0 |
| 107666 | | - ){ |
| 107667 | | - if( iCol==pTab->iPKey ){ |
| 107668 | | - iCol = -1; |
| 107669 | | - } |
| 107670 | | - break; |
| 107671 | | - } |
| 107672 | | - } |
| 107673 | | - if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ |
| 107674 | | - /* IMP: R-51414-32910 */ |
| 107675 | | - iCol = -1; |
| 107818 | + iCol = sqlite3ColumnIndex(pTab, zCol); |
| 107819 | + if( iCol>=0 ){ |
| 107820 | + if( pTab->iPKey==iCol ) iCol = -1; |
| 107821 | + }else{ |
| 107822 | + if( sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ |
| 107823 | + iCol = -1; |
| 107824 | + }else{ |
| 107825 | + iCol = pTab->nCol; |
| 107826 | + } |
| 107676 | 107827 | } |
| 107677 | 107828 | if( iCol<pTab->nCol ){ |
| 107678 | 107829 | cnt++; |
| 107679 | 107830 | pMatch = 0; |
| 107680 | 107831 | #ifndef SQLITE_OMIT_UPSERT |
| | @@ -109896,11 +110047,11 @@ |
| 109896 | 110047 | p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 109897 | 110048 | } |
| 109898 | 110049 | p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); |
| 109899 | 110050 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 109900 | 110051 | (void*)p4, P4_COLLSEQ); |
| 109901 | | - sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); |
| 110052 | + sqlite3VdbeChangeP5(pParse->pVdbe, (u16)p5); |
| 109902 | 110053 | return addr; |
| 109903 | 110054 | } |
| 109904 | 110055 | |
| 109905 | 110056 | /* |
| 109906 | 110057 | ** Return true if expression pExpr is a vector, or false otherwise. |
| | @@ -111266,11 +111417,10 @@ |
| 111266 | 111417 | pNewExpr->pLeft = pPriorSelectColNew; |
| 111267 | 111418 | } |
| 111268 | 111419 | } |
| 111269 | 111420 | pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName); |
| 111270 | 111421 | pItem->fg = pOldItem->fg; |
| 111271 | | - pItem->fg.done = 0; |
| 111272 | 111422 | pItem->u = pOldItem->u; |
| 111273 | 111423 | } |
| 111274 | 111424 | return pNew; |
| 111275 | 111425 | } |
| 111276 | 111426 | |
| | @@ -111349,20 +111499,17 @@ |
| 111349 | 111499 | SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){ |
| 111350 | 111500 | IdList *pNew; |
| 111351 | 111501 | int i; |
| 111352 | 111502 | assert( db!=0 ); |
| 111353 | 111503 | if( p==0 ) return 0; |
| 111354 | | - assert( p->eU4!=EU4_EXPR ); |
| 111355 | 111504 | pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew)+(p->nId-1)*sizeof(p->a[0]) ); |
| 111356 | 111505 | if( pNew==0 ) return 0; |
| 111357 | 111506 | pNew->nId = p->nId; |
| 111358 | | - pNew->eU4 = p->eU4; |
| 111359 | 111507 | for(i=0; i<p->nId; i++){ |
| 111360 | 111508 | struct IdList_item *pNewItem = &pNew->a[i]; |
| 111361 | 111509 | const struct IdList_item *pOldItem = &p->a[i]; |
| 111362 | 111510 | pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName); |
| 111363 | | - pNewItem->u4 = pOldItem->u4; |
| 111364 | 111511 | } |
| 111365 | 111512 | return pNew; |
| 111366 | 111513 | } |
| 111367 | 111514 | SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, const Select *pDup, int flags){ |
| 111368 | 111515 | Select *pRet = 0; |
| | @@ -112386,17 +112533,11 @@ |
| 112386 | 112533 | SQLITE_PRIVATE const char *sqlite3RowidAlias(Table *pTab){ |
| 112387 | 112534 | const char *azOpt[] = {"_ROWID_", "ROWID", "OID"}; |
| 112388 | 112535 | int ii; |
| 112389 | 112536 | assert( VisibleRowid(pTab) ); |
| 112390 | 112537 | for(ii=0; ii<ArraySize(azOpt); ii++){ |
| 112391 | | - int iCol; |
| 112392 | | - for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 112393 | | - if( sqlite3_stricmp(azOpt[ii], pTab->aCol[iCol].zCnName)==0 ) break; |
| 112394 | | - } |
| 112395 | | - if( iCol==pTab->nCol ){ |
| 112396 | | - return azOpt[ii]; |
| 112397 | | - } |
| 112538 | + if( sqlite3ColumnIndex(pTab, azOpt[ii])<0 ) return azOpt[ii]; |
| 112398 | 112539 | } |
| 112399 | 112540 | return 0; |
| 112400 | 112541 | } |
| 112401 | 112542 | |
| 112402 | 112543 | /* |
| | @@ -112702,10 +112843,11 @@ |
| 112702 | 112843 | if( mCol & colUsed ) break; /* Each column used only once */ |
| 112703 | 112844 | colUsed |= mCol; |
| 112704 | 112845 | if( aiMap ) aiMap[i] = j; |
| 112705 | 112846 | } |
| 112706 | 112847 | |
| 112848 | + assert( nExpr>0 && nExpr<BMS ); |
| 112707 | 112849 | assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) ); |
| 112708 | 112850 | if( colUsed==(MASKBIT(nExpr)-1) ){ |
| 112709 | 112851 | /* If we reach this point, that means the index pIdx is usable */ |
| 112710 | 112852 | int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); |
| 112711 | 112853 | ExplainQueryPlan((pParse, 0, |
| | @@ -112795,11 +112937,11 @@ |
| 112795 | 112937 | int nVal = sqlite3ExprVectorSize(pLeft); |
| 112796 | 112938 | Select *pSelect = ExprUseXSelect(pExpr) ? pExpr->x.pSelect : 0; |
| 112797 | 112939 | char *zRet; |
| 112798 | 112940 | |
| 112799 | 112941 | assert( pExpr->op==TK_IN ); |
| 112800 | | - zRet = sqlite3DbMallocRaw(pParse->db, nVal+1); |
| 112942 | + zRet = sqlite3DbMallocRaw(pParse->db, 1+(i64)nVal); |
| 112801 | 112943 | if( zRet ){ |
| 112802 | 112944 | int i; |
| 112803 | 112945 | for(i=0; i<nVal; i++){ |
| 112804 | 112946 | Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i); |
| 112805 | 112947 | char a = sqlite3ExprAffinity(pA); |
| | @@ -112881,10 +113023,11 @@ |
| 112881 | 113023 | for(; pOp<pEnd; pOp++){ |
| 112882 | 113024 | if( pOp->p4type!=P4_SUBRTNSIG ) continue; |
| 112883 | 113025 | assert( pOp->opcode==OP_BeginSubrtn ); |
| 112884 | 113026 | pSig = pOp->p4.pSubrtnSig; |
| 112885 | 113027 | assert( pSig!=0 ); |
| 113028 | + if( !pSig->bComplete ) continue; |
| 112886 | 113029 | if( pNewSig->selId!=pSig->selId ) continue; |
| 112887 | 113030 | if( strcmp(pNewSig->zAff,pSig->zAff)!=0 ) continue; |
| 112888 | 113031 | pExpr->y.sub.iAddr = pSig->iAddr; |
| 112889 | 113032 | pExpr->y.sub.regReturn = pSig->regReturn; |
| 112890 | 113033 | pExpr->iTable = pSig->iTable; |
| | @@ -112927,10 +113070,11 @@ |
| 112927 | 113070 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 112928 | 113071 | Expr *pLeft; /* the LHS of the IN operator */ |
| 112929 | 113072 | KeyInfo *pKeyInfo = 0; /* Key information */ |
| 112930 | 113073 | int nVal; /* Size of vector pLeft */ |
| 112931 | 113074 | Vdbe *v; /* The prepared statement under construction */ |
| 113075 | + SubrtnSig *pSig = 0; /* Signature for this subroutine */ |
| 112932 | 113076 | |
| 112933 | 113077 | v = pParse->pVdbe; |
| 112934 | 113078 | assert( v!=0 ); |
| 112935 | 113079 | |
| 112936 | 113080 | /* The evaluation of the IN must be repeated every time it |
| | @@ -112947,11 +113091,10 @@ |
| 112947 | 113091 | /* Reuse of the RHS is allowed |
| 112948 | 113092 | ** |
| 112949 | 113093 | ** Compute a signature for the RHS of the IN operator to facility |
| 112950 | 113094 | ** finding and reusing prior instances of the same IN operator. |
| 112951 | 113095 | */ |
| 112952 | | - SubrtnSig *pSig = 0; |
| 112953 | 113096 | assert( !ExprUseXSelect(pExpr) || pExpr->x.pSelect!=0 ); |
| 112954 | 113097 | if( ExprUseXSelect(pExpr) && (pExpr->x.pSelect->selFlags & SF_All)==0 ){ |
| 112955 | 113098 | pSig = sqlite3DbMallocRawNN(pParse->db, sizeof(pSig[0])); |
| 112956 | 113099 | if( pSig ){ |
| 112957 | 113100 | pSig->selId = pExpr->x.pSelect->selId; |
| | @@ -112990,10 +113133,11 @@ |
| 112990 | 113133 | assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); |
| 112991 | 113134 | pExpr->y.sub.regReturn = ++pParse->nMem; |
| 112992 | 113135 | pExpr->y.sub.iAddr = |
| 112993 | 113136 | sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1; |
| 112994 | 113137 | if( pSig ){ |
| 113138 | + pSig->bComplete = 0; |
| 112995 | 113139 | pSig->iAddr = pExpr->y.sub.iAddr; |
| 112996 | 113140 | pSig->regReturn = pExpr->y.sub.regReturn; |
| 112997 | 113141 | pSig->iTable = iTab; |
| 112998 | 113142 | pParse->mSubrtnSig = 1 << (pSig->selId&7); |
| 112999 | 113143 | sqlite3VdbeChangeP4(v, -1, (const char*)pSig, P4_SUBRTNSIG); |
| | @@ -113125,10 +113269,11 @@ |
| 113125 | 113269 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r1, 1); |
| 113126 | 113270 | } |
| 113127 | 113271 | sqlite3ReleaseTempReg(pParse, r1); |
| 113128 | 113272 | sqlite3ReleaseTempReg(pParse, r2); |
| 113129 | 113273 | } |
| 113274 | + if( pSig ) pSig->bComplete = 1; |
| 113130 | 113275 | if( pKeyInfo ){ |
| 113131 | 113276 | sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO); |
| 113132 | 113277 | } |
| 113133 | 113278 | if( addrOnce ){ |
| 113134 | 113279 | sqlite3VdbeAddOp1(v, OP_NullRow, iTab); |
| | @@ -117437,14 +117582,12 @@ |
| 117437 | 117582 | |
| 117438 | 117583 | /* Make sure the old name really is a column name in the table to be |
| 117439 | 117584 | ** altered. Set iCol to be the index of the column being renamed */ |
| 117440 | 117585 | zOld = sqlite3NameFromToken(db, pOld); |
| 117441 | 117586 | if( !zOld ) goto exit_rename_column; |
| 117442 | | - for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 117443 | | - if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break; |
| 117444 | | - } |
| 117445 | | - if( iCol==pTab->nCol ){ |
| 117587 | + iCol = sqlite3ColumnIndex(pTab, zOld); |
| 117588 | + if( iCol<0 ){ |
| 117446 | 117589 | sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pOld); |
| 117447 | 117590 | goto exit_rename_column; |
| 117448 | 117591 | } |
| 117449 | 117592 | |
| 117450 | 117593 | /* Ensure the schema contains no double-quoted strings */ |
| | @@ -119339,11 +119482,12 @@ |
| 119339 | 119482 | ** of the new table in register pParse->regRoot. This is important |
| 119340 | 119483 | ** because the OpenWrite opcode below will be needing it. */ |
| 119341 | 119484 | sqlite3NestedParse(pParse, |
| 119342 | 119485 | "CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols |
| 119343 | 119486 | ); |
| 119344 | | - aRoot[i] = (u32)pParse->regRoot; |
| 119487 | + assert( pParse->isCreate || pParse->nErr ); |
| 119488 | + aRoot[i] = (u32)pParse->u1.cr.regRoot; |
| 119345 | 119489 | aCreateTbl[i] = OPFLAG_P2ISREG; |
| 119346 | 119490 | } |
| 119347 | 119491 | }else{ |
| 119348 | 119492 | /* The table already exists. If zWhere is not NULL, delete all entries |
| 119349 | 119493 | ** associated with the table zWhere. If zWhere is NULL, delete the |
| | @@ -119530,11 +119674,11 @@ |
| 119530 | 119674 | ){ |
| 119531 | 119675 | StatAccum *p; |
| 119532 | 119676 | int nCol; /* Number of columns in index being sampled */ |
| 119533 | 119677 | int nKeyCol; /* Number of key columns */ |
| 119534 | 119678 | int nColUp; /* nCol rounded up for alignment */ |
| 119535 | | - int n; /* Bytes of space to allocate */ |
| 119679 | + i64 n; /* Bytes of space to allocate */ |
| 119536 | 119680 | sqlite3 *db = sqlite3_context_db_handle(context); /* Database connection */ |
| 119537 | 119681 | #ifdef SQLITE_ENABLE_STAT4 |
| 119538 | 119682 | /* Maximum number of samples. 0 if STAT4 data is not collected */ |
| 119539 | 119683 | int mxSample = OptimizationEnabled(db,SQLITE_Stat4) ?SQLITE_STAT4_SAMPLES :0; |
| 119540 | 119684 | #endif |
| | @@ -121304,11 +121448,11 @@ |
| 121304 | 121448 | if( db->aDb==db->aDbStatic ){ |
| 121305 | 121449 | aNew = sqlite3DbMallocRawNN(db, sizeof(db->aDb[0])*3 ); |
| 121306 | 121450 | if( aNew==0 ) return; |
| 121307 | 121451 | memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); |
| 121308 | 121452 | }else{ |
| 121309 | | - aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); |
| 121453 | + aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(1+(i64)db->nDb)); |
| 121310 | 121454 | if( aNew==0 ) return; |
| 121311 | 121455 | } |
| 121312 | 121456 | db->aDb = aNew; |
| 121313 | 121457 | pNew = &db->aDb[db->nDb]; |
| 121314 | 121458 | memset(pNew, 0, sizeof(*pNew)); |
| | @@ -121322,10 +121466,16 @@ |
| 121322 | 121466 | if( rc!=SQLITE_OK ){ |
| 121323 | 121467 | if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); |
| 121324 | 121468 | sqlite3_result_error(context, zErr, -1); |
| 121325 | 121469 | sqlite3_free(zErr); |
| 121326 | 121470 | return; |
| 121471 | + } |
| 121472 | + if( (db->flags & SQLITE_AttachWrite)==0 ){ |
| 121473 | + flags &= ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE); |
| 121474 | + flags |= SQLITE_OPEN_READONLY; |
| 121475 | + }else if( (db->flags & SQLITE_AttachCreate)==0 ){ |
| 121476 | + flags &= ~SQLITE_OPEN_CREATE; |
| 121327 | 121477 | } |
| 121328 | 121478 | assert( pVfs ); |
| 121329 | 121479 | flags |= SQLITE_OPEN_MAIN_DB; |
| 121330 | 121480 | rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); |
| 121331 | 121481 | db->nDb++; |
| | @@ -122091,10 +122241,11 @@ |
| 122091 | 122241 | p->isWriteLock = (p->isWriteLock || isWriteLock); |
| 122092 | 122242 | return; |
| 122093 | 122243 | } |
| 122094 | 122244 | } |
| 122095 | 122245 | |
| 122246 | + assert( pToplevel->nTableLock < 0x7fff0000 ); |
| 122096 | 122247 | nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1); |
| 122097 | 122248 | pToplevel->aTableLock = |
| 122098 | 122249 | sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); |
| 122099 | 122250 | if( pToplevel->aTableLock ){ |
| 122100 | 122251 | p = &pToplevel->aTableLock[pToplevel->nTableLock++]; |
| | @@ -122191,14 +122342,16 @@ |
| 122191 | 122342 | } |
| 122192 | 122343 | assert( !pParse->isMultiWrite |
| 122193 | 122344 | || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort)); |
| 122194 | 122345 | if( v ){ |
| 122195 | 122346 | if( pParse->bReturning ){ |
| 122196 | | - Returning *pReturning = pParse->u1.pReturning; |
| 122347 | + Returning *pReturning; |
| 122197 | 122348 | int addrRewind; |
| 122198 | 122349 | int reg; |
| 122199 | 122350 | |
| 122351 | + assert( !pParse->isCreate ); |
| 122352 | + pReturning = pParse->u1.d.pReturning; |
| 122200 | 122353 | if( pReturning->nRetCol ){ |
| 122201 | 122354 | sqlite3VdbeAddOp0(v, OP_FkCheck); |
| 122202 | 122355 | addrRewind = |
| 122203 | 122356 | sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); |
| 122204 | 122357 | VdbeCoverage(v); |
| | @@ -122270,11 +122423,13 @@ |
| 122270 | 122423 | sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg); |
| 122271 | 122424 | } |
| 122272 | 122425 | } |
| 122273 | 122426 | |
| 122274 | 122427 | if( pParse->bReturning ){ |
| 122275 | | - Returning *pRet = pParse->u1.pReturning; |
| 122428 | + Returning *pRet; |
| 122429 | + assert( !pParse->isCreate ); |
| 122430 | + pRet = pParse->u1.d.pReturning; |
| 122276 | 122431 | if( pRet->nRetCol ){ |
| 122277 | 122432 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); |
| 122278 | 122433 | } |
| 122279 | 122434 | } |
| 122280 | 122435 | |
| | @@ -123342,12 +123497,13 @@ |
| 123342 | 123497 | #endif |
| 123343 | 123498 | |
| 123344 | 123499 | /* If the file format and encoding in the database have not been set, |
| 123345 | 123500 | ** set them now. |
| 123346 | 123501 | */ |
| 123347 | | - reg1 = pParse->regRowid = ++pParse->nMem; |
| 123348 | | - reg2 = pParse->regRoot = ++pParse->nMem; |
| 123502 | + assert( pParse->isCreate ); |
| 123503 | + reg1 = pParse->u1.cr.regRowid = ++pParse->nMem; |
| 123504 | + reg2 = pParse->u1.cr.regRoot = ++pParse->nMem; |
| 123349 | 123505 | reg3 = ++pParse->nMem; |
| 123350 | 123506 | sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT); |
| 123351 | 123507 | sqlite3VdbeUsesBtree(v, iDb); |
| 123352 | 123508 | addr1 = sqlite3VdbeAddOp1(v, OP_If, reg3); VdbeCoverage(v); |
| 123353 | 123509 | fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ? |
| | @@ -123358,12 +123514,12 @@ |
| 123358 | 123514 | |
| 123359 | 123515 | /* This just creates a place-holder record in the sqlite_schema table. |
| 123360 | 123516 | ** The record created does not contain anything yet. It will be replaced |
| 123361 | 123517 | ** by the real entry in code generated at sqlite3EndTable(). |
| 123362 | 123518 | ** |
| 123363 | | - ** The rowid for the new entry is left in register pParse->regRowid. |
| 123364 | | - ** The root page number of the new table is left in reg pParse->regRoot. |
| 123519 | + ** The rowid for the new entry is left in register pParse->u1.cr.regRowid. |
| 123520 | + ** The root page of the new table is left in reg pParse->u1.cr.regRoot. |
| 123365 | 123521 | ** The rowid and root page number values are needed by the code that |
| 123366 | 123522 | ** sqlite3EndTable will generate. |
| 123367 | 123523 | */ |
| 123368 | 123524 | #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 123369 | 123525 | if( isView || isVirtual ){ |
| | @@ -123370,11 +123526,11 @@ |
| 123370 | 123526 | sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2); |
| 123371 | 123527 | }else |
| 123372 | 123528 | #endif |
| 123373 | 123529 | { |
| 123374 | 123530 | assert( !pParse->bReturning ); |
| 123375 | | - pParse->u1.addrCrTab = |
| 123531 | + pParse->u1.cr.addrCrTab = |
| 123376 | 123532 | sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY); |
| 123377 | 123533 | } |
| 123378 | 123534 | sqlite3OpenSchemaTable(pParse, iDb); |
| 123379 | 123535 | sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); |
| 123380 | 123536 | sqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC); |
| | @@ -123448,11 +123604,12 @@ |
| 123448 | 123604 | pRet = sqlite3DbMallocZero(db, sizeof(*pRet)); |
| 123449 | 123605 | if( pRet==0 ){ |
| 123450 | 123606 | sqlite3ExprListDelete(db, pList); |
| 123451 | 123607 | return; |
| 123452 | 123608 | } |
| 123453 | | - pParse->u1.pReturning = pRet; |
| 123609 | + assert( !pParse->isCreate ); |
| 123610 | + pParse->u1.d.pReturning = pRet; |
| 123454 | 123611 | pRet->pParse = pParse; |
| 123455 | 123612 | pRet->pReturnEL = pList; |
| 123456 | 123613 | sqlite3ParserAddCleanup(pParse, sqlite3DeleteReturning, pRet); |
| 123457 | 123614 | testcase( pParse->earlyCleanup ); |
| 123458 | 123615 | if( db->mallocFailed ) return; |
| | @@ -123490,11 +123647,10 @@ |
| 123490 | 123647 | int i; |
| 123491 | 123648 | char *z; |
| 123492 | 123649 | char *zType; |
| 123493 | 123650 | Column *pCol; |
| 123494 | 123651 | sqlite3 *db = pParse->db; |
| 123495 | | - u8 hName; |
| 123496 | 123652 | Column *aNew; |
| 123497 | 123653 | u8 eType = COLTYPE_CUSTOM; |
| 123498 | 123654 | u8 szEst = 1; |
| 123499 | 123655 | char affinity = SQLITE_AFF_BLOB; |
| 123500 | 123656 | |
| | @@ -123544,17 +123700,14 @@ |
| 123544 | 123700 | if( z==0 ) return; |
| 123545 | 123701 | if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName); |
| 123546 | 123702 | memcpy(z, sName.z, sName.n); |
| 123547 | 123703 | z[sName.n] = 0; |
| 123548 | 123704 | sqlite3Dequote(z); |
| 123549 | | - hName = sqlite3StrIHash(z); |
| 123550 | | - for(i=0; i<p->nCol; i++){ |
| 123551 | | - if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zCnName)==0 ){ |
| 123552 | | - sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); |
| 123553 | | - sqlite3DbFree(db, z); |
| 123554 | | - return; |
| 123555 | | - } |
| 123705 | + if( p->nCol && sqlite3ColumnIndex(p, z)>=0 ){ |
| 123706 | + sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); |
| 123707 | + sqlite3DbFree(db, z); |
| 123708 | + return; |
| 123556 | 123709 | } |
| 123557 | 123710 | aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0])); |
| 123558 | 123711 | if( aNew==0 ){ |
| 123559 | 123712 | sqlite3DbFree(db, z); |
| 123560 | 123713 | return; |
| | @@ -123561,11 +123714,11 @@ |
| 123561 | 123714 | } |
| 123562 | 123715 | p->aCol = aNew; |
| 123563 | 123716 | pCol = &p->aCol[p->nCol]; |
| 123564 | 123717 | memset(pCol, 0, sizeof(p->aCol[0])); |
| 123565 | 123718 | pCol->zCnName = z; |
| 123566 | | - pCol->hName = hName; |
| 123719 | + pCol->hName = sqlite3StrIHash(z); |
| 123567 | 123720 | sqlite3ColumnPropertiesFromName(p, pCol); |
| 123568 | 123721 | |
| 123569 | 123722 | if( sType.n==0 ){ |
| 123570 | 123723 | /* If there is no type specified, columns have the default affinity |
| 123571 | 123724 | ** 'BLOB' with a default size of 4 bytes. */ |
| | @@ -123585,13 +123738,18 @@ |
| 123585 | 123738 | zType[sType.n] = 0; |
| 123586 | 123739 | sqlite3Dequote(zType); |
| 123587 | 123740 | pCol->affinity = sqlite3AffinityType(zType, pCol); |
| 123588 | 123741 | pCol->colFlags |= COLFLAG_HASTYPE; |
| 123589 | 123742 | } |
| 123743 | + if( p->nCol<=0xff ){ |
| 123744 | + u8 h = pCol->hName % sizeof(p->aHx); |
| 123745 | + p->aHx[h] = p->nCol; |
| 123746 | + } |
| 123590 | 123747 | p->nCol++; |
| 123591 | 123748 | p->nNVCol++; |
| 123592 | | - pParse->constraintName.n = 0; |
| 123749 | + assert( pParse->isCreate ); |
| 123750 | + pParse->u1.cr.constraintName.n = 0; |
| 123593 | 123751 | } |
| 123594 | 123752 | |
| 123595 | 123753 | /* |
| 123596 | 123754 | ** This routine is called by the parser while in the middle of |
| 123597 | 123755 | ** parsing a CREATE TABLE statement. A "NOT NULL" constraint has |
| | @@ -123851,19 +124009,15 @@ |
| 123851 | 124009 | for(i=0; i<nTerm; i++){ |
| 123852 | 124010 | Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr); |
| 123853 | 124011 | assert( pCExpr!=0 ); |
| 123854 | 124012 | sqlite3StringToId(pCExpr); |
| 123855 | 124013 | if( pCExpr->op==TK_ID ){ |
| 123856 | | - const char *zCName; |
| 123857 | 124014 | assert( !ExprHasProperty(pCExpr, EP_IntValue) ); |
| 123858 | | - zCName = pCExpr->u.zToken; |
| 123859 | | - for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 123860 | | - if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zCnName)==0 ){ |
| 123861 | | - pCol = &pTab->aCol[iCol]; |
| 123862 | | - makeColumnPartOfPrimaryKey(pParse, pCol); |
| 123863 | | - break; |
| 123864 | | - } |
| 124015 | + iCol = sqlite3ColumnIndex(pTab, pCExpr->u.zToken); |
| 124016 | + if( iCol>=0 ){ |
| 124017 | + pCol = &pTab->aCol[iCol]; |
| 124018 | + makeColumnPartOfPrimaryKey(pParse, pCol); |
| 123865 | 124019 | } |
| 123866 | 124020 | } |
| 123867 | 124021 | } |
| 123868 | 124022 | } |
| 123869 | 124023 | if( nTerm==1 |
| | @@ -123911,12 +124065,14 @@ |
| 123911 | 124065 | sqlite3 *db = pParse->db; |
| 123912 | 124066 | if( pTab && !IN_DECLARE_VTAB |
| 123913 | 124067 | && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt) |
| 123914 | 124068 | ){ |
| 123915 | 124069 | pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); |
| 123916 | | - if( pParse->constraintName.n ){ |
| 123917 | | - sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); |
| 124070 | + assert( pParse->isCreate ); |
| 124071 | + if( pParse->u1.cr.constraintName.n ){ |
| 124072 | + sqlite3ExprListSetName(pParse, pTab->pCheck, |
| 124073 | + &pParse->u1.cr.constraintName, 1); |
| 123918 | 124074 | }else{ |
| 123919 | 124075 | Token t; |
| 123920 | 124076 | for(zStart++; sqlite3Isspace(zStart[0]); zStart++){} |
| 123921 | 124077 | while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; } |
| 123922 | 124078 | t.z = zStart; |
| | @@ -124107,11 +124263,12 @@ |
| 124107 | 124263 | ** Generate a CREATE TABLE statement appropriate for the given |
| 124108 | 124264 | ** table. Memory to hold the text of the statement is obtained |
| 124109 | 124265 | ** from sqliteMalloc() and must be freed by the calling function. |
| 124110 | 124266 | */ |
| 124111 | 124267 | static char *createTableStmt(sqlite3 *db, Table *p){ |
| 124112 | | - int i, k, n; |
| 124268 | + int i, k, len; |
| 124269 | + i64 n; |
| 124113 | 124270 | char *zStmt; |
| 124114 | 124271 | char *zSep, *zSep2, *zEnd; |
| 124115 | 124272 | Column *pCol; |
| 124116 | 124273 | n = 0; |
| 124117 | 124274 | for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){ |
| | @@ -124131,12 +124288,13 @@ |
| 124131 | 124288 | zStmt = sqlite3DbMallocRaw(0, n); |
| 124132 | 124289 | if( zStmt==0 ){ |
| 124133 | 124290 | sqlite3OomFault(db); |
| 124134 | 124291 | return 0; |
| 124135 | 124292 | } |
| 124136 | | - sqlite3_snprintf(n, zStmt, "CREATE TABLE "); |
| 124137 | | - k = sqlite3Strlen30(zStmt); |
| 124293 | + assert( n>14 && n<=0x7fffffff ); |
| 124294 | + memcpy(zStmt, "CREATE TABLE ", 13); |
| 124295 | + k = 13; |
| 124138 | 124296 | identPut(zStmt, &k, p->zName); |
| 124139 | 124297 | zStmt[k++] = '('; |
| 124140 | 124298 | for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){ |
| 124141 | 124299 | static const char * const azType[] = { |
| 124142 | 124300 | /* SQLITE_AFF_BLOB */ "", |
| | @@ -124144,17 +124302,19 @@ |
| 124144 | 124302 | /* SQLITE_AFF_NUMERIC */ " NUM", |
| 124145 | 124303 | /* SQLITE_AFF_INTEGER */ " INT", |
| 124146 | 124304 | /* SQLITE_AFF_REAL */ " REAL", |
| 124147 | 124305 | /* SQLITE_AFF_FLEXNUM */ " NUM", |
| 124148 | 124306 | }; |
| 124149 | | - int len; |
| 124150 | 124307 | const char *zType; |
| 124151 | 124308 | |
| 124152 | | - sqlite3_snprintf(n-k, &zStmt[k], zSep); |
| 124153 | | - k += sqlite3Strlen30(&zStmt[k]); |
| 124309 | + len = sqlite3Strlen30(zSep); |
| 124310 | + assert( k+len<n ); |
| 124311 | + memcpy(&zStmt[k], zSep, len); |
| 124312 | + k += len; |
| 124154 | 124313 | zSep = zSep2; |
| 124155 | 124314 | identPut(zStmt, &k, pCol->zCnName); |
| 124315 | + assert( k<n ); |
| 124156 | 124316 | assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); |
| 124157 | 124317 | assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); |
| 124158 | 124318 | testcase( pCol->affinity==SQLITE_AFF_BLOB ); |
| 124159 | 124319 | testcase( pCol->affinity==SQLITE_AFF_TEXT ); |
| 124160 | 124320 | testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); |
| | @@ -124165,15 +124325,18 @@ |
| 124165 | 124325 | zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; |
| 124166 | 124326 | len = sqlite3Strlen30(zType); |
| 124167 | 124327 | assert( pCol->affinity==SQLITE_AFF_BLOB |
| 124168 | 124328 | || pCol->affinity==SQLITE_AFF_FLEXNUM |
| 124169 | 124329 | || pCol->affinity==sqlite3AffinityType(zType, 0) ); |
| 124330 | + assert( k+len<n ); |
| 124170 | 124331 | memcpy(&zStmt[k], zType, len); |
| 124171 | 124332 | k += len; |
| 124172 | 124333 | assert( k<=n ); |
| 124173 | 124334 | } |
| 124174 | | - sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); |
| 124335 | + len = sqlite3Strlen30(zEnd); |
| 124336 | + assert( k+len<n ); |
| 124337 | + memcpy(&zStmt[k], zEnd, len+1); |
| 124175 | 124338 | return zStmt; |
| 124176 | 124339 | } |
| 124177 | 124340 | |
| 124178 | 124341 | /* |
| 124179 | 124342 | ** Resize an Index object to hold N columns total. Return SQLITE_OK |
| | @@ -124362,13 +124525,13 @@ |
| 124362 | 124525 | |
| 124363 | 124526 | /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY |
| 124364 | 124527 | ** into BTREE_BLOBKEY. |
| 124365 | 124528 | */ |
| 124366 | 124529 | assert( !pParse->bReturning ); |
| 124367 | | - if( pParse->u1.addrCrTab ){ |
| 124530 | + if( pParse->u1.cr.addrCrTab ){ |
| 124368 | 124531 | assert( v ); |
| 124369 | | - sqlite3VdbeChangeP3(v, pParse->u1.addrCrTab, BTREE_BLOBKEY); |
| 124532 | + sqlite3VdbeChangeP3(v, pParse->u1.cr.addrCrTab, BTREE_BLOBKEY); |
| 124370 | 124533 | } |
| 124371 | 124534 | |
| 124372 | 124535 | /* Locate the PRIMARY KEY index. Or, if this table was originally |
| 124373 | 124536 | ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. |
| 124374 | 124537 | */ |
| | @@ -124804,11 +124967,11 @@ |
| 124804 | 124967 | #endif |
| 124805 | 124968 | } |
| 124806 | 124969 | |
| 124807 | 124970 | /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT |
| 124808 | 124971 | ** statement to populate the new table. The root-page number for the |
| 124809 | | - ** new table is in register pParse->regRoot. |
| 124972 | + ** new table is in register pParse->u1.cr.regRoot. |
| 124810 | 124973 | ** |
| 124811 | 124974 | ** Once the SELECT has been coded by sqlite3Select(), it is in a |
| 124812 | 124975 | ** suitable state to query for the column names and types to be used |
| 124813 | 124976 | ** by the new table. |
| 124814 | 124977 | ** |
| | @@ -124835,11 +124998,12 @@ |
| 124835 | 124998 | iCsr = pParse->nTab++; |
| 124836 | 124999 | regYield = ++pParse->nMem; |
| 124837 | 125000 | regRec = ++pParse->nMem; |
| 124838 | 125001 | regRowid = ++pParse->nMem; |
| 124839 | 125002 | sqlite3MayAbort(pParse); |
| 124840 | | - sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb); |
| 125003 | + assert( pParse->isCreate ); |
| 125004 | + sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->u1.cr.regRoot, iDb); |
| 124841 | 125005 | sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); |
| 124842 | 125006 | addrTop = sqlite3VdbeCurrentAddr(v) + 1; |
| 124843 | 125007 | sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); |
| 124844 | 125008 | if( pParse->nErr ) return; |
| 124845 | 125009 | pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB); |
| | @@ -124880,21 +125044,22 @@ |
| 124880 | 125044 | |
| 124881 | 125045 | /* A slot for the record has already been allocated in the |
| 124882 | 125046 | ** schema table. We just need to update that slot with all |
| 124883 | 125047 | ** the information we've collected. |
| 124884 | 125048 | */ |
| 125049 | + assert( pParse->isCreate ); |
| 124885 | 125050 | sqlite3NestedParse(pParse, |
| 124886 | 125051 | "UPDATE %Q." LEGACY_SCHEMA_TABLE |
| 124887 | 125052 | " SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q" |
| 124888 | 125053 | " WHERE rowid=#%d", |
| 124889 | 125054 | db->aDb[iDb].zDbSName, |
| 124890 | 125055 | zType, |
| 124891 | 125056 | p->zName, |
| 124892 | 125057 | p->zName, |
| 124893 | | - pParse->regRoot, |
| 125058 | + pParse->u1.cr.regRoot, |
| 124894 | 125059 | zStmt, |
| 124895 | | - pParse->regRowid |
| 125060 | + pParse->u1.cr.regRowid |
| 124896 | 125061 | ); |
| 124897 | 125062 | sqlite3DbFree(db, zStmt); |
| 124898 | 125063 | sqlite3ChangeCookie(pParse, iDb); |
| 124899 | 125064 | |
| 124900 | 125065 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| | @@ -125861,11 +126026,11 @@ |
| 125861 | 126026 | i16 nCol, /* Total number of columns in the index */ |
| 125862 | 126027 | int nExtra, /* Number of bytes of extra space to alloc */ |
| 125863 | 126028 | char **ppExtra /* Pointer to the "extra" space */ |
| 125864 | 126029 | ){ |
| 125865 | 126030 | Index *p; /* Allocated index object */ |
| 125866 | | - int nByte; /* Bytes of space for Index object + arrays */ |
| 126031 | + i64 nByte; /* Bytes of space for Index object + arrays */ |
| 125867 | 126032 | |
| 125868 | 126033 | nByte = ROUND8(sizeof(Index)) + /* Index structure */ |
| 125869 | 126034 | ROUND8(sizeof(char*)*nCol) + /* Index.azColl */ |
| 125870 | 126035 | ROUND8(sizeof(LogEst)*(nCol+1) + /* Index.aiRowLogEst */ |
| 125871 | 126036 | sizeof(i16)*nCol + /* Index.aiColumn */ |
| | @@ -126714,11 +126879,10 @@ |
| 126714 | 126879 | */ |
| 126715 | 126880 | SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){ |
| 126716 | 126881 | int i; |
| 126717 | 126882 | assert( db!=0 ); |
| 126718 | 126883 | if( pList==0 ) return; |
| 126719 | | - assert( pList->eU4!=EU4_EXPR ); /* EU4_EXPR mode is not currently used */ |
| 126720 | 126884 | for(i=0; i<pList->nId; i++){ |
| 126721 | 126885 | sqlite3DbFree(db, pList->a[i].zName); |
| 126722 | 126886 | } |
| 126723 | 126887 | sqlite3DbNNFreeNN(db, pList); |
| 126724 | 126888 | } |
| | @@ -128095,16 +128259,22 @@ |
| 128095 | 128259 | FuncDef *p, /* The function we are evaluating for match quality */ |
| 128096 | 128260 | int nArg, /* Desired number of arguments. (-1)==any */ |
| 128097 | 128261 | u8 enc /* Desired text encoding */ |
| 128098 | 128262 | ){ |
| 128099 | 128263 | int match; |
| 128100 | | - assert( p->nArg>=-1 ); |
| 128264 | + assert( p->nArg>=(-4) && p->nArg!=(-2) ); |
| 128265 | + assert( nArg>=(-2) ); |
| 128101 | 128266 | |
| 128102 | 128267 | /* Wrong number of arguments means "no match" */ |
| 128103 | 128268 | if( p->nArg!=nArg ){ |
| 128104 | | - if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH; |
| 128269 | + if( nArg==(-2) ) return p->xSFunc==0 ? 0 : FUNC_PERFECT_MATCH; |
| 128105 | 128270 | if( p->nArg>=0 ) return 0; |
| 128271 | + /* Special p->nArg values available to built-in functions only: |
| 128272 | + ** -3 1 or more arguments required |
| 128273 | + ** -4 2 or more arguments required |
| 128274 | + */ |
| 128275 | + if( p->nArg<(-2) && nArg<(-2-p->nArg) ) return 0; |
| 128106 | 128276 | } |
| 128107 | 128277 | |
| 128108 | 128278 | /* Give a better score to a function with a specific number of arguments |
| 128109 | 128279 | ** than to function that accepts any number of arguments. */ |
| 128110 | 128280 | if( p->nArg==nArg ){ |
| | @@ -129723,20 +129893,14 @@ |
| 129723 | 129893 | const unsigned char *z; |
| 129724 | 129894 | const unsigned char *z2; |
| 129725 | 129895 | int len; |
| 129726 | 129896 | int p0type; |
| 129727 | 129897 | i64 p1, p2; |
| 129728 | | - int negP2 = 0; |
| 129729 | 129898 | |
| 129730 | 129899 | assert( argc==3 || argc==2 ); |
| 129731 | | - if( sqlite3_value_type(argv[1])==SQLITE_NULL |
| 129732 | | - || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) |
| 129733 | | - ){ |
| 129734 | | - return; |
| 129735 | | - } |
| 129736 | 129900 | p0type = sqlite3_value_type(argv[0]); |
| 129737 | | - p1 = sqlite3_value_int(argv[1]); |
| 129901 | + p1 = sqlite3_value_int64(argv[1]); |
| 129738 | 129902 | if( p0type==SQLITE_BLOB ){ |
| 129739 | 129903 | len = sqlite3_value_bytes(argv[0]); |
| 129740 | 129904 | z = sqlite3_value_blob(argv[0]); |
| 129741 | 129905 | if( z==0 ) return; |
| 129742 | 129906 | assert( len==sqlite3_value_bytes(argv[0]) ); |
| | @@ -129748,45 +129912,49 @@ |
| 129748 | 129912 | for(z2=z; *z2; len++){ |
| 129749 | 129913 | SQLITE_SKIP_UTF8(z2); |
| 129750 | 129914 | } |
| 129751 | 129915 | } |
| 129752 | 129916 | } |
| 129753 | | -#ifdef SQLITE_SUBSTR_COMPATIBILITY |
| 129754 | | - /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as |
| 129755 | | - ** as substr(X,1,N) - it returns the first N characters of X. This |
| 129756 | | - ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8] |
| 129757 | | - ** from 2009-02-02 for compatibility of applications that exploited the |
| 129758 | | - ** old buggy behavior. */ |
| 129759 | | - if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */ |
| 129760 | | -#endif |
| 129761 | 129917 | if( argc==3 ){ |
| 129762 | | - p2 = sqlite3_value_int(argv[2]); |
| 129763 | | - if( p2<0 ){ |
| 129764 | | - p2 = -p2; |
| 129765 | | - negP2 = 1; |
| 129766 | | - } |
| 129918 | + p2 = sqlite3_value_int64(argv[2]); |
| 129919 | + if( p2==0 && sqlite3_value_type(argv[2])==SQLITE_NULL ) return; |
| 129767 | 129920 | }else{ |
| 129768 | 129921 | p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH]; |
| 129769 | 129922 | } |
| 129923 | + if( p1==0 ){ |
| 129924 | +#ifdef SQLITE_SUBSTR_COMPATIBILITY |
| 129925 | + /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as |
| 129926 | + ** as substr(X,1,N) - it returns the first N characters of X. This |
| 129927 | + ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8] |
| 129928 | + ** from 2009-02-02 for compatibility of applications that exploited the |
| 129929 | + ** old buggy behavior. */ |
| 129930 | + p1 = 1; /* <rdar://problem/6778339> */ |
| 129931 | +#endif |
| 129932 | + if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return; |
| 129933 | + } |
| 129770 | 129934 | if( p1<0 ){ |
| 129771 | 129935 | p1 += len; |
| 129772 | 129936 | if( p1<0 ){ |
| 129773 | | - p2 += p1; |
| 129774 | | - if( p2<0 ) p2 = 0; |
| 129937 | + if( p2<0 ){ |
| 129938 | + p2 = 0; |
| 129939 | + }else{ |
| 129940 | + p2 += p1; |
| 129941 | + } |
| 129775 | 129942 | p1 = 0; |
| 129776 | 129943 | } |
| 129777 | 129944 | }else if( p1>0 ){ |
| 129778 | 129945 | p1--; |
| 129779 | 129946 | }else if( p2>0 ){ |
| 129780 | 129947 | p2--; |
| 129781 | 129948 | } |
| 129782 | | - if( negP2 ){ |
| 129949 | + if( p2<0 ){ |
| 129950 | + if( p2<-p1 ){ |
| 129951 | + p2 = p1; |
| 129952 | + }else{ |
| 129953 | + p2 = -p2; |
| 129954 | + } |
| 129783 | 129955 | p1 -= p2; |
| 129784 | | - if( p1<0 ){ |
| 129785 | | - p2 += p1; |
| 129786 | | - p1 = 0; |
| 129787 | | - } |
| 129788 | 129956 | } |
| 129789 | 129957 | assert( p1>=0 && p2>=0 ); |
| 129790 | 129958 | if( p0type!=SQLITE_BLOB ){ |
| 129791 | 129959 | while( *z && p1 ){ |
| 129792 | 129960 | SQLITE_SKIP_UTF8(z); |
| | @@ -129796,13 +129964,15 @@ |
| 129796 | 129964 | SQLITE_SKIP_UTF8(z2); |
| 129797 | 129965 | } |
| 129798 | 129966 | sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, |
| 129799 | 129967 | SQLITE_UTF8); |
| 129800 | 129968 | }else{ |
| 129801 | | - if( p1+p2>len ){ |
| 129969 | + if( p1>=len ){ |
| 129970 | + p1 = p2 = 0; |
| 129971 | + }else if( p2>len-p1 ){ |
| 129802 | 129972 | p2 = len-p1; |
| 129803 | | - if( p2<0 ) p2 = 0; |
| 129973 | + assert( p2>0 ); |
| 129804 | 129974 | } |
| 129805 | 129975 | sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); |
| 129806 | 129976 | } |
| 129807 | 129977 | } |
| 129808 | 129978 | |
| | @@ -129809,17 +129979,17 @@ |
| 129809 | 129979 | /* |
| 129810 | 129980 | ** Implementation of the round() function |
| 129811 | 129981 | */ |
| 129812 | 129982 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 129813 | 129983 | static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ |
| 129814 | | - int n = 0; |
| 129984 | + i64 n = 0; |
| 129815 | 129985 | double r; |
| 129816 | 129986 | char *zBuf; |
| 129817 | 129987 | assert( argc==1 || argc==2 ); |
| 129818 | 129988 | if( argc==2 ){ |
| 129819 | 129989 | if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; |
| 129820 | | - n = sqlite3_value_int(argv[1]); |
| 129990 | + n = sqlite3_value_int64(argv[1]); |
| 129821 | 129991 | if( n>30 ) n = 30; |
| 129822 | 129992 | if( n<0 ) n = 0; |
| 129823 | 129993 | } |
| 129824 | 129994 | if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; |
| 129825 | 129995 | r = sqlite3_value_double(argv[0]); |
| | @@ -129830,11 +130000,11 @@ |
| 129830 | 130000 | if( r<-4503599627370496.0 || r>+4503599627370496.0 ){ |
| 129831 | 130001 | /* The value has no fractional part so there is nothing to round */ |
| 129832 | 130002 | }else if( n==0 ){ |
| 129833 | 130003 | r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5))); |
| 129834 | 130004 | }else{ |
| 129835 | | - zBuf = sqlite3_mprintf("%!.*f",n,r); |
| 130005 | + zBuf = sqlite3_mprintf("%!.*f",(int)n,r); |
| 129836 | 130006 | if( zBuf==0 ){ |
| 129837 | 130007 | sqlite3_result_error_nomem(context); |
| 129838 | 130008 | return; |
| 129839 | 130009 | } |
| 129840 | 130010 | sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8); |
| | @@ -130789,11 +130959,11 @@ |
| 130789 | 130959 | if( zRep==0 ) return; |
| 130790 | 130960 | nRep = sqlite3_value_bytes(argv[2]); |
| 130791 | 130961 | assert( zRep==sqlite3_value_text(argv[2]) ); |
| 130792 | 130962 | nOut = nStr + 1; |
| 130793 | 130963 | assert( nOut<SQLITE_MAX_LENGTH ); |
| 130794 | | - zOut = contextMalloc(context, (i64)nOut); |
| 130964 | + zOut = contextMalloc(context, nOut); |
| 130795 | 130965 | if( zOut==0 ){ |
| 130796 | 130966 | return; |
| 130797 | 130967 | } |
| 130798 | 130968 | loopLimit = nStr - nPattern; |
| 130799 | 130969 | cntExpand = 0; |
| | @@ -130939,11 +131109,11 @@ |
| 130939 | 131109 | int i; |
| 130940 | 131110 | char *z; |
| 130941 | 131111 | for(i=0; i<argc; i++){ |
| 130942 | 131112 | n += sqlite3_value_bytes(argv[i]); |
| 130943 | 131113 | } |
| 130944 | | - n += (argc-1)*nSep; |
| 131114 | + n += (argc-1)*(i64)nSep; |
| 130945 | 131115 | z = sqlite3_malloc64(n+1); |
| 130946 | 131116 | if( z==0 ){ |
| 130947 | 131117 | sqlite3_result_error_nomem(context); |
| 130948 | 131118 | return; |
| 130949 | 131119 | } |
| | @@ -131237,11 +131407,14 @@ |
| 131237 | 131407 | ** to initialize it */ |
| 131238 | 131408 | if( ALWAYS(p) && type!=SQLITE_NULL ){ |
| 131239 | 131409 | assert( p->cnt>0 ); |
| 131240 | 131410 | p->cnt--; |
| 131241 | 131411 | if( !p->approx ){ |
| 131242 | | - p->iSum -= sqlite3_value_int64(argv[0]); |
| 131412 | + if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){ |
| 131413 | + p->ovrfl = 1; |
| 131414 | + p->approx = 1; |
| 131415 | + } |
| 131243 | 131416 | }else if( type==SQLITE_INTEGER ){ |
| 131244 | 131417 | i64 iVal = sqlite3_value_int64(argv[0]); |
| 131245 | 131418 | if( iVal!=SMALLEST_INT64 ){ |
| 131246 | 131419 | kahanBabuskaNeumaierStepInt64(p, -iVal); |
| 131247 | 131420 | }else{ |
| | @@ -132063,16 +132236,14 @@ |
| 132063 | 132236 | FUNCTION(ltrim, 2, 1, 0, trimFunc ), |
| 132064 | 132237 | FUNCTION(rtrim, 1, 2, 0, trimFunc ), |
| 132065 | 132238 | FUNCTION(rtrim, 2, 2, 0, trimFunc ), |
| 132066 | 132239 | FUNCTION(trim, 1, 3, 0, trimFunc ), |
| 132067 | 132240 | FUNCTION(trim, 2, 3, 0, trimFunc ), |
| 132068 | | - FUNCTION(min, -1, 0, 1, minmaxFunc ), |
| 132069 | | - FUNCTION(min, 0, 0, 1, 0 ), |
| 132241 | + FUNCTION(min, -3, 0, 1, minmaxFunc ), |
| 132070 | 132242 | WAGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, |
| 132071 | 132243 | SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), |
| 132072 | | - FUNCTION(max, -1, 1, 1, minmaxFunc ), |
| 132073 | | - FUNCTION(max, 0, 1, 1, 0 ), |
| 132244 | + FUNCTION(max, -3, 1, 1, minmaxFunc ), |
| 132074 | 132245 | WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, |
| 132075 | 132246 | SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), |
| 132076 | 132247 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), |
| 132077 | 132248 | FUNCTION2(subtype, 1, 0, 0, subtypeFunc, |
| 132078 | 132249 | SQLITE_FUNC_TYPEOF|SQLITE_SUBTYPE), |
| | @@ -132095,15 +132266,12 @@ |
| 132095 | 132266 | FUNCTION(upper, 1, 0, 0, upperFunc ), |
| 132096 | 132267 | FUNCTION(lower, 1, 0, 0, lowerFunc ), |
| 132097 | 132268 | FUNCTION(hex, 1, 0, 0, hexFunc ), |
| 132098 | 132269 | FUNCTION(unhex, 1, 0, 0, unhexFunc ), |
| 132099 | 132270 | FUNCTION(unhex, 2, 0, 0, unhexFunc ), |
| 132100 | | - FUNCTION(concat, -1, 0, 0, concatFunc ), |
| 132101 | | - FUNCTION(concat, 0, 0, 0, 0 ), |
| 132102 | | - FUNCTION(concat_ws, -1, 0, 0, concatwsFunc ), |
| 132103 | | - FUNCTION(concat_ws, 0, 0, 0, 0 ), |
| 132104 | | - FUNCTION(concat_ws, 1, 0, 0, 0 ), |
| 132271 | + FUNCTION(concat, -3, 0, 0, concatFunc ), |
| 132272 | + FUNCTION(concat_ws, -4, 0, 0, concatwsFunc ), |
| 132105 | 132273 | INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ), |
| 132106 | 132274 | VFUNCTION(random, 0, 0, 0, randomFunc ), |
| 132107 | 132275 | VFUNCTION(randomblob, 1, 0, 0, randomBlob ), |
| 132108 | 132276 | FUNCTION(nullif, 2, 0, 1, nullifFunc ), |
| 132109 | 132277 | DFUNCTION(sqlite_version, 0, 0, 0, versionFunc ), |
| | @@ -132143,12 +132311,10 @@ |
| 132143 | 132311 | LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), |
| 132144 | 132312 | #endif |
| 132145 | 132313 | #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| 132146 | 132314 | FUNCTION(unknown, -1, 0, 0, unknownFunc ), |
| 132147 | 132315 | #endif |
| 132148 | | - FUNCTION(coalesce, 1, 0, 0, 0 ), |
| 132149 | | - FUNCTION(coalesce, 0, 0, 0, 0 ), |
| 132150 | 132316 | #ifdef SQLITE_ENABLE_MATH_FUNCTIONS |
| 132151 | 132317 | MFUNCTION(ceil, 1, xCeil, ceilingFunc ), |
| 132152 | 132318 | MFUNCTION(ceiling, 1, xCeil, ceilingFunc ), |
| 132153 | 132319 | MFUNCTION(floor, 1, xFloor, ceilingFunc ), |
| 132154 | 132320 | #if SQLITE_HAVE_C99_MATH_FUNCS |
| | @@ -132182,15 +132348,13 @@ |
| 132182 | 132348 | MFUNCTION(radians, 1, degToRad, math1Func ), |
| 132183 | 132349 | MFUNCTION(degrees, 1, radToDeg, math1Func ), |
| 132184 | 132350 | MFUNCTION(pi, 0, 0, piFunc ), |
| 132185 | 132351 | #endif /* SQLITE_ENABLE_MATH_FUNCTIONS */ |
| 132186 | 132352 | FUNCTION(sign, 1, 0, 0, signFunc ), |
| 132187 | | - INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ), |
| 132188 | | - INLINE_FUNC(iif, 2, INLINEFUNC_iif, 0 ), |
| 132189 | | - INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ), |
| 132190 | | - INLINE_FUNC(if, 2, INLINEFUNC_iif, 0 ), |
| 132191 | | - INLINE_FUNC(if, 3, INLINEFUNC_iif, 0 ), |
| 132353 | + INLINE_FUNC(coalesce, -4, INLINEFUNC_coalesce, 0 ), |
| 132354 | + INLINE_FUNC(iif, -4, INLINEFUNC_iif, 0 ), |
| 132355 | + INLINE_FUNC(if, -4, INLINEFUNC_iif, 0 ), |
| 132192 | 132356 | }; |
| 132193 | 132357 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 132194 | 132358 | sqlite3AlterFunctions(); |
| 132195 | 132359 | #endif |
| 132196 | 132360 | sqlite3WindowFunctions(); |
| | @@ -134632,10 +134796,11 @@ |
| 134632 | 134796 | int regRowCount = 0; /* Memory cell used for the row counter */ |
| 134633 | 134797 | int regIns; /* Block of regs holding rowid+data being inserted */ |
| 134634 | 134798 | int regRowid; /* registers holding insert rowid */ |
| 134635 | 134799 | int regData; /* register holding first column to insert */ |
| 134636 | 134800 | int *aRegIdx = 0; /* One register allocated to each index */ |
| 134801 | + int *aTabColMap = 0; /* Mapping from pTab columns to pCol entries */ |
| 134637 | 134802 | |
| 134638 | 134803 | #ifndef SQLITE_OMIT_TRIGGER |
| 134639 | 134804 | int isView; /* True if attempting to insert into a view */ |
| 134640 | 134805 | Trigger *pTrigger; /* List of triggers on pTab, if required */ |
| 134641 | 134806 | int tmask; /* Mask of trigger times */ |
| | @@ -134776,35 +134941,29 @@ |
| 134776 | 134941 | ** columns into storage order. False negatives are harmless, |
| 134777 | 134942 | ** but false positives will cause database corruption. |
| 134778 | 134943 | */ |
| 134779 | 134944 | bIdListInOrder = (pTab->tabFlags & (TF_OOOHidden|TF_HasStored))==0; |
| 134780 | 134945 | if( pColumn ){ |
| 134781 | | - assert( pColumn->eU4!=EU4_EXPR ); |
| 134782 | | - pColumn->eU4 = EU4_IDX; |
| 134783 | | - for(i=0; i<pColumn->nId; i++){ |
| 134784 | | - pColumn->a[i].u4.idx = -1; |
| 134785 | | - } |
| 134786 | | - for(i=0; i<pColumn->nId; i++){ |
| 134787 | | - for(j=0; j<pTab->nCol; j++){ |
| 134788 | | - if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zCnName)==0 ){ |
| 134789 | | - pColumn->a[i].u4.idx = j; |
| 134790 | | - if( i!=j ) bIdListInOrder = 0; |
| 134791 | | - if( j==pTab->iPKey ){ |
| 134792 | | - ipkColumn = i; assert( !withoutRowid ); |
| 134793 | | - } |
| 134794 | | -#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 134795 | | - if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ |
| 134796 | | - sqlite3ErrorMsg(pParse, |
| 134797 | | - "cannot INSERT into generated column \"%s\"", |
| 134798 | | - pTab->aCol[j].zCnName); |
| 134799 | | - goto insert_cleanup; |
| 134800 | | - } |
| 134801 | | -#endif |
| 134802 | | - break; |
| 134803 | | - } |
| 134804 | | - } |
| 134805 | | - if( j>=pTab->nCol ){ |
| 134946 | + aTabColMap = sqlite3DbMallocZero(db, pTab->nCol*sizeof(int)); |
| 134947 | + if( aTabColMap==0 ) goto insert_cleanup; |
| 134948 | + for(i=0; i<pColumn->nId; i++){ |
| 134949 | + j = sqlite3ColumnIndex(pTab, pColumn->a[i].zName); |
| 134950 | + if( j>=0 ){ |
| 134951 | + if( aTabColMap[j]==0 ) aTabColMap[j] = i+1; |
| 134952 | + if( i!=j ) bIdListInOrder = 0; |
| 134953 | + if( j==pTab->iPKey ){ |
| 134954 | + ipkColumn = i; assert( !withoutRowid ); |
| 134955 | + } |
| 134956 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 134957 | + if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ |
| 134958 | + sqlite3ErrorMsg(pParse, |
| 134959 | + "cannot INSERT into generated column \"%s\"", |
| 134960 | + pTab->aCol[j].zCnName); |
| 134961 | + goto insert_cleanup; |
| 134962 | + } |
| 134963 | +#endif |
| 134964 | + }else{ |
| 134806 | 134965 | if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ |
| 134807 | 134966 | ipkColumn = i; |
| 134808 | 134967 | bIdListInOrder = 0; |
| 134809 | 134968 | }else{ |
| 134810 | 134969 | sqlite3ErrorMsg(pParse, "table %S has no column named %s", |
| | @@ -135098,29 +135257,29 @@ |
| 135098 | 135257 | sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); |
| 135099 | 135258 | } |
| 135100 | 135259 | continue; |
| 135101 | 135260 | }else if( pColumn==0 ){ |
| 135102 | 135261 | /* Hidden columns that are not explicitly named in the INSERT |
| 135103 | | - ** get there default value */ |
| 135262 | + ** get their default value */ |
| 135104 | 135263 | sqlite3ExprCodeFactorable(pParse, |
| 135105 | 135264 | sqlite3ColumnExpr(pTab, &pTab->aCol[i]), |
| 135106 | 135265 | iRegStore); |
| 135107 | 135266 | continue; |
| 135108 | 135267 | } |
| 135109 | 135268 | } |
| 135110 | 135269 | if( pColumn ){ |
| 135111 | | - assert( pColumn->eU4==EU4_IDX ); |
| 135112 | | - for(j=0; j<pColumn->nId && pColumn->a[j].u4.idx!=i; j++){} |
| 135113 | | - if( j>=pColumn->nId ){ |
| 135270 | + j = aTabColMap[i]; |
| 135271 | + assert( j>=0 && j<=pColumn->nId ); |
| 135272 | + if( j==0 ){ |
| 135114 | 135273 | /* A column not named in the insert column list gets its |
| 135115 | 135274 | ** default value */ |
| 135116 | 135275 | sqlite3ExprCodeFactorable(pParse, |
| 135117 | 135276 | sqlite3ColumnExpr(pTab, &pTab->aCol[i]), |
| 135118 | 135277 | iRegStore); |
| 135119 | 135278 | continue; |
| 135120 | 135279 | } |
| 135121 | | - k = j; |
| 135280 | + k = j - 1; |
| 135122 | 135281 | }else if( nColumn==0 ){ |
| 135123 | 135282 | /* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */ |
| 135124 | 135283 | sqlite3ExprCodeFactorable(pParse, |
| 135125 | 135284 | sqlite3ColumnExpr(pTab, &pTab->aCol[i]), |
| 135126 | 135285 | iRegStore); |
| | @@ -135361,11 +135520,14 @@ |
| 135361 | 135520 | insert_cleanup: |
| 135362 | 135521 | sqlite3SrcListDelete(db, pTabList); |
| 135363 | 135522 | sqlite3ExprListDelete(db, pList); |
| 135364 | 135523 | sqlite3UpsertDelete(db, pUpsert); |
| 135365 | 135524 | sqlite3SelectDelete(db, pSelect); |
| 135366 | | - sqlite3IdListDelete(db, pColumn); |
| 135525 | + if( pColumn ){ |
| 135526 | + sqlite3IdListDelete(db, pColumn); |
| 135527 | + sqlite3DbFree(db, aTabColMap); |
| 135528 | + } |
| 135367 | 135529 | if( aRegIdx ) sqlite3DbNNFreeNN(db, aRegIdx); |
| 135368 | 135530 | } |
| 135369 | 135531 | |
| 135370 | 135532 | /* Make sure "isView" and other macros defined above are undefined. Otherwise |
| 135371 | 135533 | ** they may interfere with compilation of other functions in this file |
| | @@ -140708,11 +140870,14 @@ |
| 140708 | 140870 | ){ |
| 140709 | 140871 | db->flags |= mask; |
| 140710 | 140872 | } |
| 140711 | 140873 | }else{ |
| 140712 | 140874 | db->flags &= ~mask; |
| 140713 | | - if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; |
| 140875 | + if( mask==SQLITE_DeferFKs ){ |
| 140876 | + db->nDeferredImmCons = 0; |
| 140877 | + db->nDeferredCons = 0; |
| 140878 | + } |
| 140714 | 140879 | if( (mask & SQLITE_WriteSchema)!=0 |
| 140715 | 140880 | && sqlite3_stricmp(zRight, "reset")==0 |
| 140716 | 140881 | ){ |
| 140717 | 140882 | /* IMP: R-60817-01178 If the argument is "RESET" then schema |
| 140718 | 140883 | ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, |
| | @@ -141316,11 +141481,11 @@ |
| 141316 | 141481 | sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt); |
| 141317 | 141482 | sqlite3ClearTempRegCache(pParse); |
| 141318 | 141483 | |
| 141319 | 141484 | /* Do the b-tree integrity checks */ |
| 141320 | 141485 | sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); |
| 141321 | | - sqlite3VdbeChangeP5(v, (u8)i); |
| 141486 | + sqlite3VdbeChangeP5(v, (u16)i); |
| 141322 | 141487 | addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); |
| 141323 | 141488 | sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, |
| 141324 | 141489 | sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), |
| 141325 | 141490 | P4_DYNAMIC); |
| 141326 | 141491 | sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); |
| | @@ -144042,14 +144207,37 @@ |
| 144042 | 144207 | ** Return the index of a column in a table. Return -1 if the column |
| 144043 | 144208 | ** is not contained in the table. |
| 144044 | 144209 | */ |
| 144045 | 144210 | SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){ |
| 144046 | 144211 | int i; |
| 144047 | | - u8 h = sqlite3StrIHash(zCol); |
| 144048 | | - Column *pCol; |
| 144049 | | - for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){ |
| 144050 | | - if( pCol->hName==h && sqlite3StrICmp(pCol->zCnName, zCol)==0 ) return i; |
| 144212 | + u8 h; |
| 144213 | + const Column *aCol; |
| 144214 | + int nCol; |
| 144215 | + |
| 144216 | + h = sqlite3StrIHash(zCol); |
| 144217 | + aCol = pTab->aCol; |
| 144218 | + nCol = pTab->nCol; |
| 144219 | + |
| 144220 | + /* See if the aHx gives us a lucky match */ |
| 144221 | + i = pTab->aHx[h % sizeof(pTab->aHx)]; |
| 144222 | + assert( i<nCol ); |
| 144223 | + if( aCol[i].hName==h |
| 144224 | + && sqlite3StrICmp(aCol[i].zCnName, zCol)==0 |
| 144225 | + ){ |
| 144226 | + return i; |
| 144227 | + } |
| 144228 | + |
| 144229 | + /* No lucky match from the hash table. Do a full search. */ |
| 144230 | + i = 0; |
| 144231 | + while( 1 /*exit-by-break*/ ){ |
| 144232 | + if( aCol[i].hName==h |
| 144233 | + && sqlite3StrICmp(aCol[i].zCnName, zCol)==0 |
| 144234 | + ){ |
| 144235 | + return i; |
| 144236 | + } |
| 144237 | + i++; |
| 144238 | + if( i>=nCol ) break; |
| 144051 | 144239 | } |
| 144052 | 144240 | return -1; |
| 144053 | 144241 | } |
| 144054 | 144242 | |
| 144055 | 144243 | /* |
| | @@ -150549,11 +150737,11 @@ |
| 150549 | 150737 | } |
| 150550 | 150738 | sqlite3ReleaseTempReg(pParse, regSubtype); |
| 150551 | 150739 | } |
| 150552 | 150740 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150553 | 150741 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150554 | | - sqlite3VdbeChangeP5(v, (u8)nArg); |
| 150742 | + sqlite3VdbeChangeP5(v, (u16)nArg); |
| 150555 | 150743 | sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); |
| 150556 | 150744 | sqlite3VdbeJumpHere(v, iTop); |
| 150557 | 150745 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150558 | 150746 | } |
| 150559 | 150747 | sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), |
| | @@ -150712,11 +150900,11 @@ |
| 150712 | 150900 | sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, |
| 150713 | 150901 | (char *)pColl, P4_COLLSEQ); |
| 150714 | 150902 | } |
| 150715 | 150903 | sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); |
| 150716 | 150904 | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); |
| 150717 | | - sqlite3VdbeChangeP5(v, (u8)nArg); |
| 150905 | + sqlite3VdbeChangeP5(v, (u16)nArg); |
| 150718 | 150906 | sqlite3ReleaseTempRange(pParse, regAgg, nArg); |
| 150719 | 150907 | } |
| 150720 | 150908 | if( addrNext ){ |
| 150721 | 150909 | sqlite3VdbeResolveLabel(v, addrNext); |
| 150722 | 150910 | } |
| | @@ -152767,11 +152955,12 @@ |
| 152767 | 152955 | }else if( pTrig->op==TK_RETURNING ){ |
| 152768 | 152956 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 152769 | 152957 | assert( pParse->db->pVtabCtx==0 ); |
| 152770 | 152958 | #endif |
| 152771 | 152959 | assert( pParse->bReturning ); |
| 152772 | | - assert( &(pParse->u1.pReturning->retTrig) == pTrig ); |
| 152960 | + assert( !pParse->isCreate ); |
| 152961 | + assert( &(pParse->u1.d.pReturning->retTrig) == pTrig ); |
| 152773 | 152962 | pTrig->table = pTab->zName; |
| 152774 | 152963 | pTrig->pTabSchema = pTab->pSchema; |
| 152775 | 152964 | pTrig->pNext = pList; |
| 152776 | 152965 | pList = pTrig; |
| 152777 | 152966 | } |
| | @@ -153744,11 +153933,12 @@ |
| 153744 | 153933 | /* This RETURNING trigger must be for a different statement as |
| 153745 | 153934 | ** this statement lacks a RETURNING clause. */ |
| 153746 | 153935 | return; |
| 153747 | 153936 | } |
| 153748 | 153937 | assert( db->pParse==pParse ); |
| 153749 | | - pReturning = pParse->u1.pReturning; |
| 153938 | + assert( !pParse->isCreate ); |
| 153939 | + pReturning = pParse->u1.d.pReturning; |
| 153750 | 153940 | if( pTrigger != &(pReturning->retTrig) ){ |
| 153751 | 153941 | /* This RETURNING trigger is for a different statement */ |
| 153752 | 153942 | return; |
| 153753 | 153943 | } |
| 153754 | 153944 | memset(&sSelect, 0, sizeof(sSelect)); |
| | @@ -153974,10 +154164,12 @@ |
| 153974 | 154164 | sSubParse.pToplevel = pTop; |
| 153975 | 154165 | sSubParse.zAuthContext = pTrigger->zName; |
| 153976 | 154166 | sSubParse.eTriggerOp = pTrigger->op; |
| 153977 | 154167 | sSubParse.nQueryLoop = pParse->nQueryLoop; |
| 153978 | 154168 | sSubParse.prepFlags = pParse->prepFlags; |
| 154169 | + sSubParse.oldmask = 0; |
| 154170 | + sSubParse.newmask = 0; |
| 153979 | 154171 | |
| 153980 | 154172 | v = sqlite3GetVdbe(&sSubParse); |
| 153981 | 154173 | if( v ){ |
| 153982 | 154174 | VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", |
| 153983 | 154175 | pTrigger->zName, onErrorText(orconf), |
| | @@ -154106,11 +154298,11 @@ |
| 154106 | 154298 | /* Set the P5 operand of the OP_Program instruction to non-zero if |
| 154107 | 154299 | ** recursive invocation of this trigger program is disallowed. Recursive |
| 154108 | 154300 | ** invocation is disallowed if (a) the sub-program is really a trigger, |
| 154109 | 154301 | ** not a foreign key action, and (b) the flag to enable recursive triggers |
| 154110 | 154302 | ** is clear. */ |
| 154111 | | - sqlite3VdbeChangeP5(v, (u8)bRecursive); |
| 154303 | + sqlite3VdbeChangeP5(v, (u16)bRecursive); |
| 154112 | 154304 | } |
| 154113 | 154305 | } |
| 154114 | 154306 | |
| 154115 | 154307 | /* |
| 154116 | 154308 | ** This is called to code the required FOR EACH ROW triggers for an operation |
| | @@ -154728,42 +154920,36 @@ |
| 154728 | 154920 | ** column to be updated, make sure we have authorization to change |
| 154729 | 154921 | ** that column. |
| 154730 | 154922 | */ |
| 154731 | 154923 | chngRowid = chngPk = 0; |
| 154732 | 154924 | for(i=0; i<pChanges->nExpr; i++){ |
| 154733 | | - u8 hCol = sqlite3StrIHash(pChanges->a[i].zEName); |
| 154734 | 154925 | /* If this is an UPDATE with a FROM clause, do not resolve expressions |
| 154735 | 154926 | ** here. The call to sqlite3Select() below will do that. */ |
| 154736 | 154927 | if( nChangeFrom==0 && sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ |
| 154737 | 154928 | goto update_cleanup; |
| 154738 | 154929 | } |
| 154739 | | - for(j=0; j<pTab->nCol; j++){ |
| 154740 | | - if( pTab->aCol[j].hName==hCol |
| 154741 | | - && sqlite3StrICmp(pTab->aCol[j].zCnName, pChanges->a[i].zEName)==0 |
| 154742 | | - ){ |
| 154743 | | - if( j==pTab->iPKey ){ |
| 154744 | | - chngRowid = 1; |
| 154745 | | - pRowidExpr = pChanges->a[i].pExpr; |
| 154746 | | - iRowidExpr = i; |
| 154747 | | - }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ |
| 154748 | | - chngPk = 1; |
| 154749 | | - } |
| 154930 | + j = sqlite3ColumnIndex(pTab, pChanges->a[i].zEName); |
| 154931 | + if( j>=0 ){ |
| 154932 | + if( j==pTab->iPKey ){ |
| 154933 | + chngRowid = 1; |
| 154934 | + pRowidExpr = pChanges->a[i].pExpr; |
| 154935 | + iRowidExpr = i; |
| 154936 | + }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ |
| 154937 | + chngPk = 1; |
| 154938 | + } |
| 154750 | 154939 | #ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 154751 | | - else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ |
| 154752 | | - testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); |
| 154753 | | - testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); |
| 154754 | | - sqlite3ErrorMsg(pParse, |
| 154755 | | - "cannot UPDATE generated column \"%s\"", |
| 154756 | | - pTab->aCol[j].zCnName); |
| 154757 | | - goto update_cleanup; |
| 154758 | | - } |
| 154940 | + else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ |
| 154941 | + testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); |
| 154942 | + testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); |
| 154943 | + sqlite3ErrorMsg(pParse, |
| 154944 | + "cannot UPDATE generated column \"%s\"", |
| 154945 | + pTab->aCol[j].zCnName); |
| 154946 | + goto update_cleanup; |
| 154947 | + } |
| 154759 | 154948 | #endif |
| 154760 | | - aXRef[j] = i; |
| 154761 | | - break; |
| 154762 | | - } |
| 154763 | | - } |
| 154764 | | - if( j>=pTab->nCol ){ |
| 154949 | + aXRef[j] = i; |
| 154950 | + }else{ |
| 154765 | 154951 | if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zEName) ){ |
| 154766 | 154952 | j = -1; |
| 154767 | 154953 | chngRowid = 1; |
| 154768 | 154954 | pRowidExpr = pChanges->a[i].pExpr; |
| 154769 | 154955 | iRowidExpr = i; |
| | @@ -156866,24 +157052,25 @@ |
| 156866 | 157052 | |
| 156867 | 157053 | /* A slot for the record has already been allocated in the |
| 156868 | 157054 | ** schema table. We just need to update that slot with all |
| 156869 | 157055 | ** the information we've collected. |
| 156870 | 157056 | ** |
| 156871 | | - ** The VM register number pParse->regRowid holds the rowid of an |
| 157057 | + ** The VM register number pParse->u1.cr.regRowid holds the rowid of an |
| 156872 | 157058 | ** entry in the sqlite_schema table that was created for this vtab |
| 156873 | 157059 | ** by sqlite3StartTable(). |
| 156874 | 157060 | */ |
| 156875 | 157061 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 157062 | + assert( pParse->isCreate ); |
| 156876 | 157063 | sqlite3NestedParse(pParse, |
| 156877 | 157064 | "UPDATE %Q." LEGACY_SCHEMA_TABLE " " |
| 156878 | 157065 | "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q " |
| 156879 | 157066 | "WHERE rowid=#%d", |
| 156880 | 157067 | db->aDb[iDb].zDbSName, |
| 156881 | 157068 | pTab->zName, |
| 156882 | 157069 | pTab->zName, |
| 156883 | 157070 | zStmt, |
| 156884 | | - pParse->regRowid |
| 157071 | + pParse->u1.cr.regRowid |
| 156885 | 157072 | ); |
| 156886 | 157073 | v = sqlite3GetVdbe(pParse); |
| 156887 | 157074 | sqlite3ChangeCookie(pParse, iDb); |
| 156888 | 157075 | |
| 156889 | 157076 | sqlite3VdbeAddOp0(v, OP_Expire); |
| | @@ -157217,11 +157404,13 @@ |
| 157217 | 157404 | ** sqlite3_declare_vtab() is being misused. |
| 157218 | 157405 | */ |
| 157219 | 157406 | z = (const unsigned char*)zCreateTable; |
| 157220 | 157407 | for(i=0; aKeyword[i]; i++){ |
| 157221 | 157408 | int tokenType = 0; |
| 157222 | | - do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE ); |
| 157409 | + do{ |
| 157410 | + z += sqlite3GetToken(z, &tokenType); |
| 157411 | + }while( tokenType==TK_SPACE || tokenType==TK_COMMENT ); |
| 157223 | 157412 | if( tokenType!=aKeyword[i] ){ |
| 157224 | 157413 | sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error"); |
| 157225 | 157414 | return SQLITE_ERROR; |
| 157226 | 157415 | } |
| 157227 | 157416 | } |
| | @@ -157948,12 +158137,14 @@ |
| 157948 | 158137 | u16 nLTerm; /* Number of entries in aLTerm[] */ |
| 157949 | 158138 | u16 nSkip; /* Number of NULL aLTerm[] entries */ |
| 157950 | 158139 | /**** whereLoopXfer() copies fields above ***********************/ |
| 157951 | 158140 | # define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot) |
| 157952 | 158141 | u16 nLSlot; /* Number of slots allocated for aLTerm[] */ |
| 158142 | +#ifdef WHERETRACE_ENABLED |
| 157953 | 158143 | LogEst rStarDelta; /* Cost delta due to star-schema heuristic. Not |
| 157954 | | - ** initialized unless pWInfo->nOutStarDelta>0 */ |
| 158144 | + ** initialized unless pWInfo->bStarUsed */ |
| 158145 | +#endif |
| 157955 | 158146 | WhereTerm **aLTerm; /* WhereTerms used */ |
| 157956 | 158147 | WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */ |
| 157957 | 158148 | WhereTerm *aLTermSpace[3]; /* Initial aLTerm[] space */ |
| 157958 | 158149 | }; |
| 157959 | 158150 | |
| | @@ -157998,11 +158189,11 @@ |
| 157998 | 158189 | struct WherePath { |
| 157999 | 158190 | Bitmask maskLoop; /* Bitmask of all WhereLoop objects in this path */ |
| 158000 | 158191 | Bitmask revLoop; /* aLoop[]s that should be reversed for ORDER BY */ |
| 158001 | 158192 | LogEst nRow; /* Estimated number of rows generated by this path */ |
| 158002 | 158193 | LogEst rCost; /* Total cost of this path */ |
| 158003 | | - LogEst rUnsorted; /* Total cost of this path ignoring sorting costs */ |
| 158194 | + LogEst rUnsort; /* Total cost of this path ignoring sorting costs */ |
| 158004 | 158195 | i8 isOrdered; /* No. of ORDER BY terms satisfied. -1 for unknown */ |
| 158005 | 158196 | WhereLoop **aLoop; /* Array of WhereLoop objects implementing this path */ |
| 158006 | 158197 | }; |
| 158007 | 158198 | |
| 158008 | 158199 | /* |
| | @@ -158271,13 +158462,17 @@ |
| 158271 | 158462 | u8 eOnePass; /* ONEPASS_OFF, or _SINGLE, or _MULTI */ |
| 158272 | 158463 | u8 eDistinct; /* One of the WHERE_DISTINCT_* values */ |
| 158273 | 158464 | unsigned bDeferredSeek :1; /* Uses OP_DeferredSeek */ |
| 158274 | 158465 | unsigned untestedTerms :1; /* Not all WHERE terms resolved by outer loop */ |
| 158275 | 158466 | unsigned bOrderedInnerLoop:1;/* True if only the inner-most loop is ordered */ |
| 158276 | | - unsigned sorted :1; /* True if really sorted (not just grouped) */ |
| 158277 | | - LogEst nOutStarDelta; /* Artifical nOut reduction for star-query */ |
| 158467 | + unsigned sorted :1; /* True if really sorted (not just grouped) */ |
| 158468 | + unsigned bStarDone :1; /* True if check for star-query is complete */ |
| 158469 | + unsigned bStarUsed :1; /* True if star-query heuristic is used */ |
| 158278 | 158470 | LogEst nRowOut; /* Estimated number of output rows */ |
| 158471 | +#ifdef WHERETRACE_ENABLED |
| 158472 | + LogEst rTotalCost; /* Total cost of the solution */ |
| 158473 | +#endif |
| 158279 | 158474 | int iTop; /* The very beginning of the WHERE loop */ |
| 158280 | 158475 | int iEndWhere; /* End of the WHERE clause itself */ |
| 158281 | 158476 | WhereLoop *pLoops; /* List of all WhereLoop objects */ |
| 158282 | 158477 | WhereMemBlock *pMemToFree;/* Memory to free when this object destroyed */ |
| 158283 | 158478 | Bitmask revMask; /* Mask of ORDER BY terms that need reversing */ |
| | @@ -160029,10 +160224,13 @@ |
| 160029 | 160224 | } |
| 160030 | 160225 | } |
| 160031 | 160226 | } |
| 160032 | 160227 | sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); |
| 160033 | 160228 | sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); |
| 160229 | + /* The instruction immediately prior to OP_VFilter must be an OP_Integer |
| 160230 | + ** that sets the "argc" value for xVFilter. This is necessary for |
| 160231 | + ** resolveP2() to work correctly. See tag-20250207a. */ |
| 160034 | 160232 | sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, |
| 160035 | 160233 | pLoop->u.vtab.idxStr, |
| 160036 | 160234 | pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC); |
| 160037 | 160235 | VdbeCoverage(v); |
| 160038 | 160236 | pLoop->u.vtab.needFree = 0; |
| | @@ -161584,24 +161782,26 @@ |
| 161584 | 161782 | }else if( op==TK_STRING ){ |
| 161585 | 161783 | assert( !ExprHasProperty(pRight, EP_IntValue) ); |
| 161586 | 161784 | z = (u8*)pRight->u.zToken; |
| 161587 | 161785 | } |
| 161588 | 161786 | if( z ){ |
| 161589 | | - /* Count the number of prefix bytes prior to the first wildcard. |
| 161590 | | - ** or U+fffd character. If the underlying database has a UTF16LE |
| 161591 | | - ** encoding, then only consider ASCII characters. Note that the |
| 161592 | | - ** encoding of z[] is UTF8 - we are dealing with only UTF8 here in |
| 161593 | | - ** this code, but the database engine itself might be processing |
| 161594 | | - ** content using a different encoding. */ |
| 161787 | + /* Count the number of prefix bytes prior to the first wildcard, |
| 161788 | + ** U+fffd character, or malformed utf-8. If the underlying database |
| 161789 | + ** has a UTF16LE encoding, then only consider ASCII characters. Note that |
| 161790 | + ** the encoding of z[] is UTF8 - we are dealing with only UTF8 here in this |
| 161791 | + ** code, but the database engine itself might be processing content using a |
| 161792 | + ** different encoding. */ |
| 161595 | 161793 | cnt = 0; |
| 161596 | 161794 | while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ |
| 161597 | 161795 | cnt++; |
| 161598 | 161796 | if( c==wc[3] && z[cnt]>0 && z[cnt]<0x80 ){ |
| 161599 | 161797 | cnt++; |
| 161600 | 161798 | }else if( c>=0x80 ){ |
| 161601 | 161799 | const u8 *z2 = z+cnt-1; |
| 161602 | | - if( sqlite3Utf8Read(&z2)==0xfffd || ENC(db)==SQLITE_UTF16LE ){ |
| 161800 | + if( c==0xff || sqlite3Utf8Read(&z2)==0xfffd /* bad utf-8 */ |
| 161801 | + || ENC(db)==SQLITE_UTF16LE |
| 161802 | + ){ |
| 161603 | 161803 | cnt--; |
| 161604 | 161804 | break; |
| 161605 | 161805 | }else{ |
| 161606 | 161806 | cnt = (int)(z2-z); |
| 161607 | 161807 | } |
| | @@ -162749,24 +162949,30 @@ |
| 162749 | 162949 | pStr2->u.zToken[i] = sqlite3Tolower(c); |
| 162750 | 162950 | } |
| 162751 | 162951 | } |
| 162752 | 162952 | |
| 162753 | 162953 | if( !db->mallocFailed ){ |
| 162754 | | - u8 c, *pC; /* Last character before the first wildcard */ |
| 162954 | + u8 *pC; /* Last character before the first wildcard */ |
| 162755 | 162955 | pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1]; |
| 162756 | | - c = *pC; |
| 162757 | 162956 | if( noCase ){ |
| 162758 | 162957 | /* The point is to increment the last character before the first |
| 162759 | 162958 | ** wildcard. But if we increment '@', that will push it into the |
| 162760 | 162959 | ** alphabetic range where case conversions will mess up the |
| 162761 | 162960 | ** inequality. To avoid this, make sure to also run the full |
| 162762 | 162961 | ** LIKE on all candidate expressions by clearing the isComplete flag |
| 162763 | 162962 | */ |
| 162764 | | - if( c=='A'-1 ) isComplete = 0; |
| 162765 | | - c = sqlite3UpperToLower[c]; |
| 162963 | + if( *pC=='A'-1 ) isComplete = 0; |
| 162964 | + *pC = sqlite3UpperToLower[*pC]; |
| 162766 | 162965 | } |
| 162767 | | - *pC = c + 1; |
| 162966 | + |
| 162967 | + /* Increment the value of the last utf8 character in the prefix. */ |
| 162968 | + while( *pC==0xBF && pC>(u8*)pStr2->u.zToken ){ |
| 162969 | + *pC = 0x80; |
| 162970 | + pC--; |
| 162971 | + } |
| 162972 | + assert( *pC!=0xFF ); /* isLikeOrGlob() guarantees this */ |
| 162973 | + (*pC)++; |
| 162768 | 162974 | } |
| 162769 | 162975 | zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY; |
| 162770 | 162976 | pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); |
| 162771 | 162977 | pNewExpr1 = sqlite3PExpr(pParse, TK_GE, |
| 162772 | 162978 | sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName), |
| | @@ -164130,10 +164336,15 @@ |
| 164130 | 164336 | ** |
| 164131 | 164337 | ** 2. If iCol is part of an existing index that has an aiRowLogEst of |
| 164132 | 164338 | ** more than 20, then return false. |
| 164133 | 164339 | ** |
| 164134 | 164340 | ** 3. If no disqualifying conditions above are found, return true. |
| 164341 | +** |
| 164342 | +** 2025-01-03: I experimented with a new rule that returns false if the |
| 164343 | +** the datatype of the column is "BOOLEAN". This did not improve |
| 164344 | +** performance on any queries at hand, but it did burn CPU cycles, so the |
| 164345 | +** idea was not committed. |
| 164135 | 164346 | */ |
| 164136 | 164347 | static SQLITE_NOINLINE int columnIsGoodIndexCandidate( |
| 164137 | 164348 | const Table *pTab, |
| 164138 | 164349 | int iCol |
| 164139 | 164350 | ){ |
| | @@ -164214,11 +164425,11 @@ |
| 164214 | 164425 | char *zText = 0; |
| 164215 | 164426 | int ii = 0; |
| 164216 | 164427 | sqlite3_str *pStr = sqlite3_str_new(pParse->db); |
| 164217 | 164428 | sqlite3_str_appendf(pStr,"CREATE AUTOMATIC INDEX ON %s(", pTab->zName); |
| 164218 | 164429 | assert( pIdx->nColumn>1 ); |
| 164219 | | - assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID ); |
| 164430 | + assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID || !HasRowid(pTab) ); |
| 164220 | 164431 | for(ii=0; ii<(pIdx->nColumn-1); ii++){ |
| 164221 | 164432 | const char *zName = 0; |
| 164222 | 164433 | int iCol = pIdx->aiColumn[ii]; |
| 164223 | 164434 | |
| 164224 | 164435 | zName = pTab->aCol[iCol].zCnName; |
| | @@ -164344,10 +164555,23 @@ |
| 164344 | 164555 | */ |
| 164345 | 164556 | if( IsView(pTable) ){ |
| 164346 | 164557 | extraCols = ALLBITS & ~idxCols; |
| 164347 | 164558 | }else{ |
| 164348 | 164559 | extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); |
| 164560 | + } |
| 164561 | + if( !HasRowid(pTable) ){ |
| 164562 | + /* For WITHOUT ROWID tables, ensure that all PRIMARY KEY columns are |
| 164563 | + ** either in the idxCols mask or in the extraCols mask */ |
| 164564 | + for(i=0; i<pTable->nCol; i++){ |
| 164565 | + if( (pTable->aCol[i].colFlags & COLFLAG_PRIMKEY)==0 ) continue; |
| 164566 | + if( i>=BMS-1 ){ |
| 164567 | + extraCols |= MASKBIT(BMS-1); |
| 164568 | + break; |
| 164569 | + } |
| 164570 | + if( idxCols & MASKBIT(i) ) continue; |
| 164571 | + extraCols |= MASKBIT(i); |
| 164572 | + } |
| 164349 | 164573 | } |
| 164350 | 164574 | mxBitCol = MIN(BMS-1,pTable->nCol); |
| 164351 | 164575 | testcase( pTable->nCol==BMS-1 ); |
| 164352 | 164576 | testcase( pTable->nCol==BMS-2 ); |
| 164353 | 164577 | for(i=0; i<mxBitCol; i++){ |
| | @@ -164356,11 +164580,12 @@ |
| 164356 | 164580 | if( pSrc->colUsed & MASKBIT(BMS-1) ){ |
| 164357 | 164581 | nKeyCol += pTable->nCol - BMS + 1; |
| 164358 | 164582 | } |
| 164359 | 164583 | |
| 164360 | 164584 | /* Construct the Index object to describe this index */ |
| 164361 | | - pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); |
| 164585 | + pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+HasRowid(pTable), |
| 164586 | + 0, &zNotUsed); |
| 164362 | 164587 | if( pIdx==0 ) goto end_auto_index_create; |
| 164363 | 164588 | pLoop->u.btree.pIndex = pIdx; |
| 164364 | 164589 | pIdx->zName = "auto-index"; |
| 164365 | 164590 | pIdx->pTable = pTable; |
| 164366 | 164591 | n = 0; |
| | @@ -164412,12 +164637,14 @@ |
| 164412 | 164637 | pIdx->azColl[n] = sqlite3StrBINARY; |
| 164413 | 164638 | n++; |
| 164414 | 164639 | } |
| 164415 | 164640 | } |
| 164416 | 164641 | assert( n==nKeyCol ); |
| 164417 | | - pIdx->aiColumn[n] = XN_ROWID; |
| 164418 | | - pIdx->azColl[n] = sqlite3StrBINARY; |
| 164642 | + if( HasRowid(pTable) ){ |
| 164643 | + pIdx->aiColumn[n] = XN_ROWID; |
| 164644 | + pIdx->azColl[n] = sqlite3StrBINARY; |
| 164645 | + } |
| 164419 | 164646 | |
| 164420 | 164647 | /* Create the automatic index */ |
| 164421 | 164648 | explainAutomaticIndex(pParse, pIdx, pPartial!=0, &addrExp); |
| 164422 | 164649 | assert( pLevel->iIdxCur>=0 ); |
| 164423 | 164650 | pLevel->iIdxCur = pParse->nTab++; |
| | @@ -165680,21 +165907,23 @@ |
| 165680 | 165907 | ** | | | __|__ nEq ---. ___|__ | __|__ |
| 165681 | 165908 | ** | / \ / \ / \ | / \ / \ / \ |
| 165682 | 165909 | ** 1.002.001 t2.t2xy 2 f 010241 N 2 cost 0,56,31 |
| 165683 | 165910 | */ |
| 165684 | 165911 | SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){ |
| 165912 | + WhereInfo *pWInfo; |
| 165685 | 165913 | if( pWC ){ |
| 165686 | | - WhereInfo *pWInfo = pWC->pWInfo; |
| 165914 | + pWInfo = pWC->pWInfo; |
| 165687 | 165915 | int nb = 1+(pWInfo->pTabList->nSrc+3)/4; |
| 165688 | 165916 | SrcItem *pItem = pWInfo->pTabList->a + p->iTab; |
| 165689 | 165917 | Table *pTab = pItem->pSTab; |
| 165690 | 165918 | Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1; |
| 165691 | 165919 | sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, |
| 165692 | 165920 | p->iTab, nb, p->maskSelf, nb, p->prereq & mAll); |
| 165693 | 165921 | sqlite3DebugPrintf(" %12s", |
| 165694 | 165922 | pItem->zAlias ? pItem->zAlias : pTab->zName); |
| 165695 | 165923 | }else{ |
| 165924 | + pWInfo = 0; |
| 165696 | 165925 | sqlite3DebugPrintf("%c%2d.%03llx.%03llx %c%d", |
| 165697 | 165926 | p->cId, p->iTab, p->maskSelf, p->prereq & 0xfff, p->cId, p->iTab); |
| 165698 | 165927 | } |
| 165699 | 165928 | if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){ |
| 165700 | 165929 | const char *zName; |
| | @@ -165722,11 +165951,16 @@ |
| 165722 | 165951 | if( p->wsFlags & WHERE_SKIPSCAN ){ |
| 165723 | 165952 | sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); |
| 165724 | 165953 | }else{ |
| 165725 | 165954 | sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm); |
| 165726 | 165955 | } |
| 165727 | | - sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); |
| 165956 | + if( pWInfo && pWInfo->bStarUsed && p->rStarDelta!=0 ){ |
| 165957 | + sqlite3DebugPrintf(" cost %d,%d,%d delta=%d\n", |
| 165958 | + p->rSetup, p->rRun, p->nOut, p->rStarDelta); |
| 165959 | + }else{ |
| 165960 | + sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); |
| 165961 | + } |
| 165728 | 165962 | if( p->nLTerm && (sqlite3WhereTrace & 0x4000)!=0 ){ |
| 165729 | 165963 | int i; |
| 165730 | 165964 | for(i=0; i<p->nLTerm; i++){ |
| 165731 | 165965 | sqlite3WhereTermPrint(p->aLTerm[i], i); |
| 165732 | 165966 | } |
| | @@ -167188,11 +167422,10 @@ |
| 167188 | 167422 | if( !pBuilder->pOrSet /* Not part of an OR optimization */ |
| 167189 | 167423 | && (pWInfo->wctrlFlags & (WHERE_RIGHT_JOIN|WHERE_OR_SUBCLAUSE))==0 |
| 167190 | 167424 | && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 |
| 167191 | 167425 | && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */ |
| 167192 | 167426 | && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */ |
| 167193 | | - && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */ |
| 167194 | 167427 | && !pSrc->fg.isCorrelated /* Not a correlated subquery */ |
| 167195 | 167428 | && !pSrc->fg.isRecursive /* Not a recursive common table expression. */ |
| 167196 | 167429 | && (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */ |
| 167197 | 167430 | ){ |
| 167198 | 167431 | /* Generate auto-index WhereLoops */ |
| | @@ -168691,72 +168924,205 @@ |
| 168691 | 168924 | ** The value returned is a tuning parameter. Currently the value is: |
| 168692 | 168925 | ** |
| 168693 | 168926 | ** 18 for star queries |
| 168694 | 168927 | ** 12 otherwise |
| 168695 | 168928 | ** |
| 168696 | | -** For the purposes of SQLite, a star-query is defined as a query |
| 168697 | | -** with a large central table that is joined against four or more |
| 168698 | | -** smaller tables. The central table is called the "fact" table. |
| 168699 | | -** The smaller tables that get joined are "dimension tables". |
| 168929 | +** For the purposes of this heuristic, a star-query is defined as a query |
| 168930 | +** with a large central table that is joined using an INNER JOIN, |
| 168931 | +** not CROSS or OUTER JOINs, against four or more smaller tables. |
| 168932 | +** The central table is called the "fact" table. The smaller tables |
| 168933 | +** that get joined are "dimension tables". Also, any table that is |
| 168934 | +** self-joined cannot be a dimension table; we assume that dimension |
| 168935 | +** tables may only be joined against fact tables. |
| 168700 | 168936 | ** |
| 168701 | 168937 | ** SIDE EFFECT: (and really the whole point of this subroutine) |
| 168702 | 168938 | ** |
| 168703 | | -** If pWInfo describes a star-query, then the cost on WhereLoops for the |
| 168704 | | -** fact table is reduced. This heuristic helps keep fact tables in |
| 168705 | | -** outer loops. Without this heuristic, paths with fact tables in outer |
| 168706 | | -** loops tend to get pruned by the mxChoice limit on the number of paths, |
| 168707 | | -** resulting in poor query plans. The total amount of heuristic cost |
| 168708 | | -** adjustment is stored in pWInfo->nOutStarDelta and the cost adjustment |
| 168709 | | -** for each WhereLoop is stored in its rStarDelta field. |
| 168939 | +** If pWInfo describes a star-query, then the cost for SCANs of dimension |
| 168940 | +** WhereLoops is increased to be slightly larger than the cost of a SCAN |
| 168941 | +** in the fact table. Only SCAN costs are increased. SEARCH costs are |
| 168942 | +** unchanged. This heuristic helps keep fact tables in outer loops. Without |
| 168943 | +** this heuristic, paths with fact tables in outer loops tend to get pruned |
| 168944 | +** by the mxChoice limit on the number of paths, resulting in poor query |
| 168945 | +** plans. See the starschema1.test test module for examples of queries |
| 168946 | +** that need this heuristic to find good query plans. |
| 168947 | +** |
| 168948 | +** This heuristic can be completely disabled, so that no query is |
| 168949 | +** considered a star-query, using SQLITE_TESTCTRL_OPTIMIZATION to |
| 168950 | +** disable the SQLITE_StarQuery optimization. In the CLI, the command |
| 168951 | +** to do that is: ".testctrl opt -starquery". |
| 168952 | +** |
| 168953 | +** HISTORICAL NOTES: |
| 168954 | +** |
| 168955 | +** This optimization was first added on 2024-05-09 by check-in 38db9b5c83d. |
| 168956 | +** The original optimization reduced the cost and output size estimate for |
| 168957 | +** fact tables to help them move to outer loops. But months later (as people |
| 168958 | +** started upgrading) performance regression reports started caming in, |
| 168959 | +** including: |
| 168960 | +** |
| 168961 | +** forum post b18ef983e68d06d1 (2024-12-21) |
| 168962 | +** forum post 0025389d0860af82 (2025-01-14) |
| 168963 | +** forum post d87570a145599033 (2025-01-17) |
| 168964 | +** |
| 168965 | +** To address these, the criteria for a star-query was tightened to exclude |
| 168966 | +** cases where the fact and dimensions are separated by an outer join, and |
| 168967 | +** the affect of star-schema detection was changed to increase the rRun cost |
| 168968 | +** on just full table scans of dimension tables, rather than reducing costs |
| 168969 | +** in the all access methods of the fact table. |
| 168710 | 168970 | */ |
| 168711 | | -static int computeMxChoice(WhereInfo *pWInfo, LogEst nRowEst){ |
| 168971 | +static int computeMxChoice(WhereInfo *pWInfo){ |
| 168712 | 168972 | int nLoop = pWInfo->nLevel; /* Number of terms in the join */ |
| 168713 | | - if( nRowEst==0 && nLoop>=5 ){ |
| 168714 | | - /* Check to see if we are dealing with a star schema and if so, reduce |
| 168715 | | - ** the cost of fact tables relative to dimension tables, as a heuristic |
| 168716 | | - ** to help keep the fact tables in outer loops. |
| 168973 | + WhereLoop *pWLoop; /* For looping over WhereLoops */ |
| 168974 | + |
| 168975 | +#ifdef SQLITE_DEBUG |
| 168976 | + /* The star-query detection code below makes use of the following |
| 168977 | + ** properties of the WhereLoop list, so verify them before |
| 168978 | + ** continuing: |
| 168979 | + ** (1) .maskSelf is the bitmask corresponding to .iTab |
| 168980 | + ** (2) The WhereLoop list is in ascending .iTab order |
| 168981 | + */ |
| 168982 | + for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 168983 | + assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) ); |
| 168984 | + assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab ); |
| 168985 | + } |
| 168986 | +#endif /* SQLITE_DEBUG */ |
| 168987 | + |
| 168988 | + if( nLoop>=5 |
| 168989 | + && !pWInfo->bStarDone |
| 168990 | + && OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery) |
| 168991 | + ){ |
| 168992 | + SrcItem *aFromTabs; /* All terms of the FROM clause */ |
| 168993 | + int iFromIdx; /* Term of FROM clause is the candidate fact-table */ |
| 168994 | + Bitmask m; /* Bitmask for candidate fact-table */ |
| 168995 | + Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */ |
| 168996 | + WhereLoop *pStart; /* Where to start searching for dimension-tables */ |
| 168997 | + |
| 168998 | + pWInfo->bStarDone = 1; /* Only do this computation once */ |
| 168999 | + |
| 169000 | + /* Look for fact tables with four or more dimensions where the |
| 169001 | + ** dimension tables are not separately from the fact tables by an outer |
| 169002 | + ** or cross join. Adjust cost weights if found. |
| 168717 | 169003 | */ |
| 168718 | | - int iLoop; /* Counter over join terms */ |
| 168719 | | - Bitmask m; /* Bitmask for current loop */ |
| 168720 | | - assert( pWInfo->nOutStarDelta==0 ); |
| 168721 | | - for(iLoop=0, m=1; iLoop<nLoop; iLoop++, m<<=1){ |
| 168722 | | - WhereLoop *pWLoop; /* For looping over WhereLoops */ |
| 169004 | + assert( !pWInfo->bStarUsed ); |
| 169005 | + aFromTabs = pWInfo->pTabList->a; |
| 169006 | + pStart = pWInfo->pLoops; |
| 169007 | + for(iFromIdx=0, m=1; iFromIdx<nLoop; iFromIdx++, m<<=1){ |
| 168723 | 169008 | int nDep = 0; /* Number of dimension tables */ |
| 168724 | | - LogEst rDelta; /* Heuristic cost adjustment */ |
| 169009 | + LogEst mxRun; /* Maximum SCAN cost of a fact table */ |
| 168725 | 169010 | Bitmask mSeen = 0; /* Mask of dimension tables */ |
| 168726 | | - for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 168727 | | - if( (pWLoop->prereq & m)!=0 && (pWLoop->maskSelf & mSeen)==0 ){ |
| 168728 | | - nDep++; |
| 168729 | | - mSeen |= pWLoop->maskSelf; |
| 169011 | + SrcItem *pFactTab; /* The candidate fact table */ |
| 169012 | + |
| 169013 | + pFactTab = aFromTabs + iFromIdx; |
| 169014 | + if( (pFactTab->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){ |
| 169015 | + /* If the candidate fact-table is the right table of an outer join |
| 169016 | + ** restrict the search for dimension-tables to be tables to the right |
| 169017 | + ** of the fact-table. */ |
| 169018 | + if( iFromIdx+4 > nLoop ) break; /* Impossible to reach nDep>=4 */ |
| 169019 | + while( pStart && pStart->iTab<=iFromIdx ){ |
| 169020 | + pStart = pStart->pNextLoop; |
| 169021 | + } |
| 169022 | + } |
| 169023 | + for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 169024 | + if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){ |
| 169025 | + /* Fact-tables and dimension-tables cannot be separated by an |
| 169026 | + ** outer join (at least for the definition of fact- and dimension- |
| 169027 | + ** used by this heuristic). */ |
| 169028 | + break; |
| 169029 | + } |
| 169030 | + if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */ |
| 169031 | + && (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */ |
| 169032 | + && (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */ |
| 169033 | + ){ |
| 169034 | + if( aFromTabs[pWLoop->iTab].pSTab==pFactTab->pSTab ){ |
| 169035 | + mSelfJoin |= m; |
| 169036 | + }else{ |
| 169037 | + nDep++; |
| 169038 | + mSeen |= pWLoop->maskSelf; |
| 169039 | + } |
| 168730 | 169040 | } |
| 168731 | 169041 | } |
| 168732 | 169042 | if( nDep<=3 ) continue; |
| 168733 | | - rDelta = 15*(nDep-3); |
| 168734 | | -#ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 168735 | | - if( sqlite3WhereTrace&0x4 ){ |
| 168736 | | - SrcItem *pItem = pWInfo->pTabList->a + iLoop; |
| 168737 | | - sqlite3DebugPrintf("Fact-table %s: %d dimensions, cost reduced %d\n", |
| 168738 | | - pItem->zAlias ? pItem->zAlias : pItem->pSTab->zName, |
| 168739 | | - nDep, rDelta); |
| 168740 | | - } |
| 168741 | | -#endif |
| 168742 | | - if( pWInfo->nOutStarDelta==0 ){ |
| 169043 | + |
| 169044 | + /* If we reach this point, it means that pFactTab is a fact table |
| 169045 | + ** with four or more dimensions connected by inner joins. Proceed |
| 169046 | + ** to make cost adjustments. */ |
| 169047 | + |
| 169048 | +#ifdef WHERETRACE_ENABLED |
| 169049 | + /* Make sure rStarDelta values are initialized */ |
| 169050 | + if( !pWInfo->bStarUsed ){ |
| 168743 | 169051 | for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 168744 | 169052 | pWLoop->rStarDelta = 0; |
| 168745 | 169053 | } |
| 168746 | 169054 | } |
| 168747 | | - pWInfo->nOutStarDelta += rDelta; |
| 169055 | +#endif |
| 169056 | + pWInfo->bStarUsed = 1; |
| 169057 | + |
| 169058 | + /* Compute the maximum cost of any WhereLoop for the |
| 169059 | + ** fact table plus one epsilon */ |
| 169060 | + mxRun = LOGEST_MIN; |
| 169061 | + for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 169062 | + if( pWLoop->iTab<iFromIdx ) continue; |
| 169063 | + if( pWLoop->iTab>iFromIdx ) break; |
| 169064 | + if( pWLoop->rRun>mxRun ) mxRun = pWLoop->rRun; |
| 169065 | + } |
| 169066 | + if( ALWAYS(mxRun<LOGEST_MAX) ) mxRun++; |
| 169067 | + |
| 169068 | + /* Increase the cost of table scans for dimension tables to be |
| 169069 | + ** slightly more than the maximum cost of the fact table */ |
| 169070 | + for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 169071 | + if( (pWLoop->maskSelf & mSeen)==0 ) continue; |
| 169072 | + if( pWLoop->nLTerm ) continue; |
| 169073 | + if( pWLoop->rRun<mxRun ){ |
| 169074 | +#ifdef WHERETRACE_ENABLED /* 0x80000 */ |
| 169075 | + if( sqlite3WhereTrace & 0x80000 ){ |
| 169076 | + SrcItem *pDim = aFromTabs + pWLoop->iTab; |
| 169077 | + sqlite3DebugPrintf( |
| 169078 | + "Increase SCAN cost of dimension %s(%d) of fact %s(%d) to %d\n", |
| 169079 | + pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab, |
| 169080 | + pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName, |
| 169081 | + iFromIdx, mxRun |
| 169082 | + ); |
| 169083 | + } |
| 169084 | + pWLoop->rStarDelta = mxRun - pWLoop->rRun; |
| 169085 | +#endif /* WHERETRACE_ENABLED */ |
| 169086 | + pWLoop->rRun = mxRun; |
| 169087 | + } |
| 169088 | + } |
| 169089 | + } |
| 169090 | +#ifdef WHERETRACE_ENABLED /* 0x80000 */ |
| 169091 | + if( (sqlite3WhereTrace & 0x80000)!=0 && pWInfo->bStarUsed ){ |
| 169092 | + sqlite3DebugPrintf("WhereLoops changed by star-query heuristic:\n"); |
| 168748 | 169093 | for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 168749 | | - if( pWLoop->maskSelf==m ){ |
| 168750 | | - pWLoop->rRun -= rDelta; |
| 168751 | | - pWLoop->nOut -= rDelta; |
| 168752 | | - pWLoop->rStarDelta = rDelta; |
| 169094 | + if( pWLoop->rStarDelta ){ |
| 169095 | + sqlite3WhereLoopPrint(pWLoop, &pWInfo->sWC); |
| 168753 | 169096 | } |
| 168754 | 169097 | } |
| 168755 | 169098 | } |
| 169099 | +#endif |
| 168756 | 169100 | } |
| 168757 | | - return pWInfo->nOutStarDelta>0 ? 18 : 12; |
| 169101 | + return pWInfo->bStarUsed ? 18 : 12; |
| 169102 | +} |
| 169103 | + |
| 169104 | +/* |
| 169105 | +** Two WhereLoop objects, pCandidate and pBaseline, are known to have the |
| 169106 | +** same cost. Look deep into each to see if pCandidate is even slightly |
| 169107 | +** better than pBaseline. Return false if it is, if pCandidate is is preferred. |
| 169108 | +** Return true if pBaseline is preferred or if we cannot tell the difference. |
| 169109 | +** |
| 169110 | +** Result Meaning |
| 169111 | +** -------- ---------------------------------------------------------- |
| 169112 | +** true We cannot tell the difference in pCandidate and pBaseline |
| 169113 | +** false pCandidate seems like a better choice than pBaseline |
| 169114 | +*/ |
| 169115 | +static SQLITE_NOINLINE int whereLoopIsNoBetter( |
| 169116 | + const WhereLoop *pCandidate, |
| 169117 | + const WhereLoop *pBaseline |
| 169118 | +){ |
| 169119 | + if( (pCandidate->wsFlags & WHERE_INDEXED)==0 ) return 1; |
| 169120 | + if( (pBaseline->wsFlags & WHERE_INDEXED)==0 ) return 1; |
| 169121 | + if( pCandidate->u.btree.pIndex->szIdxRow < |
| 169122 | + pBaseline->u.btree.pIndex->szIdxRow ) return 0; |
| 169123 | + return 1; |
| 168758 | 169124 | } |
| 168759 | 169125 | |
| 168760 | 169126 | /* |
| 168761 | 169127 | ** Given the list of WhereLoop objects at pWInfo->pLoops, this routine |
| 168762 | 169128 | ** attempts to find the lowest cost path that visits each WhereLoop |
| | @@ -168776,11 +169142,11 @@ |
| 168776 | 169142 | int iLoop; /* Loop counter over the terms of the join */ |
| 168777 | 169143 | int ii, jj; /* Loop counters */ |
| 168778 | 169144 | int mxI = 0; /* Index of next entry to replace */ |
| 168779 | 169145 | int nOrderBy; /* Number of ORDER BY clause terms */ |
| 168780 | 169146 | LogEst mxCost = 0; /* Maximum cost of a set of paths */ |
| 168781 | | - LogEst mxUnsorted = 0; /* Maximum unsorted cost of a set of path */ |
| 169147 | + LogEst mxUnsort = 0; /* Maximum unsorted cost of a set of path */ |
| 168782 | 169148 | int nTo, nFrom; /* Number of valid entries in aTo[] and aFrom[] */ |
| 168783 | 169149 | WherePath *aFrom; /* All nFrom paths at the previous level */ |
| 168784 | 169150 | WherePath *aTo; /* The nTo best paths at the current level */ |
| 168785 | 169151 | WherePath *pFrom; /* An element of aFrom[] that we are working on */ |
| 168786 | 169152 | WherePath *pTo; /* An element of aTo[] that we are working on */ |
| | @@ -168805,12 +169171,14 @@ |
| 168805 | 169171 | */ |
| 168806 | 169172 | if( nLoop<=1 ){ |
| 168807 | 169173 | mxChoice = 1; |
| 168808 | 169174 | }else if( nLoop==2 ){ |
| 168809 | 169175 | mxChoice = 5; |
| 169176 | + }else if( pParse->nErr ){ |
| 169177 | + mxChoice = 1; |
| 168810 | 169178 | }else{ |
| 168811 | | - mxChoice = computeMxChoice(pWInfo, nRowEst); |
| 169179 | + mxChoice = computeMxChoice(pWInfo); |
| 168812 | 169180 | } |
| 168813 | 169181 | assert( nLoop<=pWInfo->pTabList->nSrc ); |
| 168814 | 169182 | |
| 168815 | 169183 | /* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this |
| 168816 | 169184 | ** case the purpose of this call is to estimate the number of rows returned |
| | @@ -168873,11 +169241,11 @@ |
| 168873 | 169241 | nTo = 0; |
| 168874 | 169242 | for(ii=0, pFrom=aFrom; ii<nFrom; ii++, pFrom++){ |
| 168875 | 169243 | for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ |
| 168876 | 169244 | LogEst nOut; /* Rows visited by (pFrom+pWLoop) */ |
| 168877 | 169245 | LogEst rCost; /* Cost of path (pFrom+pWLoop) */ |
| 168878 | | - LogEst rUnsorted; /* Unsorted cost of (pFrom+pWLoop) */ |
| 169246 | + LogEst rUnsort; /* Unsorted cost of (pFrom+pWLoop) */ |
| 168879 | 169247 | i8 isOrdered; /* isOrdered for (pFrom+pWLoop) */ |
| 168880 | 169248 | Bitmask maskNew; /* Mask of src visited by (..) */ |
| 168881 | 169249 | Bitmask revMask; /* Mask of rev-order loops for (..) */ |
| 168882 | 169250 | |
| 168883 | 169251 | if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue; |
| | @@ -168891,15 +169259,15 @@ |
| 168891 | 169259 | continue; |
| 168892 | 169260 | } |
| 168893 | 169261 | |
| 168894 | 169262 | /* At this point, pWLoop is a candidate to be the next loop. |
| 168895 | 169263 | ** Compute its cost */ |
| 168896 | | - rUnsorted = pWLoop->rRun + pFrom->nRow; |
| 169264 | + rUnsort = pWLoop->rRun + pFrom->nRow; |
| 168897 | 169265 | if( pWLoop->rSetup ){ |
| 168898 | | - rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup, rUnsorted); |
| 169266 | + rUnsort = sqlite3LogEstAdd(pWLoop->rSetup, rUnsort); |
| 168899 | 169267 | } |
| 168900 | | - rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted); |
| 169268 | + rUnsort = sqlite3LogEstAdd(rUnsort, pFrom->rUnsort); |
| 168901 | 169269 | nOut = pFrom->nRow + pWLoop->nOut; |
| 168902 | 169270 | maskNew = pFrom->maskLoop | pWLoop->maskSelf; |
| 168903 | 169271 | isOrdered = pFrom->isOrdered; |
| 168904 | 169272 | if( isOrdered<0 ){ |
| 168905 | 169273 | revMask = 0; |
| | @@ -168917,19 +169285,19 @@ |
| 168917 | 169285 | } |
| 168918 | 169286 | /* TUNING: Add a small extra penalty (3) to sorting as an |
| 168919 | 169287 | ** extra encouragement to the query planner to select a plan |
| 168920 | 169288 | ** where the rows emerge in the correct order without any sorting |
| 168921 | 169289 | ** required. */ |
| 168922 | | - rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 3; |
| 169290 | + rCost = sqlite3LogEstAdd(rUnsort, aSortCost[isOrdered]) + 3; |
| 168923 | 169291 | |
| 168924 | 169292 | WHERETRACE(0x002, |
| 168925 | 169293 | ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n", |
| 168926 | 169294 | aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, |
| 168927 | | - rUnsorted, rCost)); |
| 169295 | + rUnsort, rCost)); |
| 168928 | 169296 | }else{ |
| 168929 | | - rCost = rUnsorted; |
| 168930 | | - rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */ |
| 169297 | + rCost = rUnsort; |
| 169298 | + rUnsort -= 2; /* TUNING: Slight bias in favor of no-sort plans */ |
| 168931 | 169299 | } |
| 168932 | 169300 | |
| 168933 | 169301 | /* Check to see if pWLoop should be added to the set of |
| 168934 | 169302 | ** mxChoice best-so-far paths. |
| 168935 | 169303 | ** |
| | @@ -168951,19 +169319,19 @@ |
| 168951 | 169319 | } |
| 168952 | 169320 | } |
| 168953 | 169321 | if( jj>=nTo ){ |
| 168954 | 169322 | /* None of the existing best-so-far paths match the candidate. */ |
| 168955 | 169323 | if( nTo>=mxChoice |
| 168956 | | - && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted)) |
| 169324 | + && (rCost>mxCost || (rCost==mxCost && rUnsort>=mxUnsort)) |
| 168957 | 169325 | ){ |
| 168958 | 169326 | /* The current candidate is no better than any of the mxChoice |
| 168959 | 169327 | ** paths currently in the best-so-far buffer. So discard |
| 168960 | 169328 | ** this candidate as not viable. */ |
| 168961 | 169329 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 168962 | 169330 | if( sqlite3WhereTrace&0x4 ){ |
| 168963 | 169331 | sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n", |
| 168964 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 169332 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort, |
| 168965 | 169333 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 168966 | 169334 | } |
| 168967 | 169335 | #endif |
| 168968 | 169336 | continue; |
| 168969 | 169337 | } |
| | @@ -168978,11 +169346,11 @@ |
| 168978 | 169346 | } |
| 168979 | 169347 | pTo = &aTo[jj]; |
| 168980 | 169348 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 168981 | 169349 | if( sqlite3WhereTrace&0x4 ){ |
| 168982 | 169350 | sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n", |
| 168983 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 169351 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort, |
| 168984 | 169352 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 168985 | 169353 | } |
| 168986 | 169354 | #endif |
| 168987 | 169355 | }else{ |
| 168988 | 169356 | /* Control reaches here if best-so-far path pTo=aTo[jj] covers the |
| | @@ -168989,28 +169357,27 @@ |
| 168989 | 169357 | ** same set of loops and has the same isOrdered setting as the |
| 168990 | 169358 | ** candidate path. Check to see if the candidate should replace |
| 168991 | 169359 | ** pTo or if the candidate should be skipped. |
| 168992 | 169360 | ** |
| 168993 | 169361 | ** The conditional is an expanded vector comparison equivalent to: |
| 168994 | | - ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted) |
| 169362 | + ** (pTo->rCost,pTo->nRow,pTo->rUnsort) <= (rCost,nOut,rUnsort) |
| 168995 | 169363 | */ |
| 168996 | | - if( pTo->rCost<rCost |
| 168997 | | - || (pTo->rCost==rCost |
| 168998 | | - && (pTo->nRow<nOut |
| 168999 | | - || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted) |
| 169000 | | - ) |
| 169001 | | - ) |
| 169364 | + if( (pTo->rCost<rCost) |
| 169365 | + || (pTo->rCost==rCost && pTo->nRow<nOut) |
| 169366 | + || (pTo->rCost==rCost && pTo->nRow==nOut && pTo->rUnsort<rUnsort) |
| 169367 | + || (pTo->rCost==rCost && pTo->nRow==nOut && pTo->rUnsort==rUnsort |
| 169368 | + && whereLoopIsNoBetter(pWLoop, pTo->aLoop[iLoop]) ) |
| 169002 | 169369 | ){ |
| 169003 | 169370 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 169004 | 169371 | if( sqlite3WhereTrace&0x4 ){ |
| 169005 | 169372 | sqlite3DebugPrintf( |
| 169006 | 169373 | "Skip %s cost=%-3d,%3d,%3d order=%c", |
| 169007 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 169374 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort, |
| 169008 | 169375 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 169009 | 169376 | sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n", |
| 169010 | 169377 | wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, |
| 169011 | | - pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 169378 | + pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 169012 | 169379 | } |
| 169013 | 169380 | #endif |
| 169014 | 169381 | /* Discard the candidate path from further consideration */ |
| 169015 | 169382 | testcase( pTo->rCost==rCost ); |
| 169016 | 169383 | continue; |
| | @@ -169020,37 +169387,37 @@ |
| 169020 | 169387 | ** pTo path. Replace pTo with the candidate. */ |
| 169021 | 169388 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 169022 | 169389 | if( sqlite3WhereTrace&0x4 ){ |
| 169023 | 169390 | sqlite3DebugPrintf( |
| 169024 | 169391 | "Update %s cost=%-3d,%3d,%3d order=%c", |
| 169025 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 169392 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort, |
| 169026 | 169393 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 169027 | 169394 | sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n", |
| 169028 | 169395 | wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, |
| 169029 | | - pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 169396 | + pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 169030 | 169397 | } |
| 169031 | 169398 | #endif |
| 169032 | 169399 | } |
| 169033 | 169400 | /* pWLoop is a winner. Add it to the set of best so far */ |
| 169034 | 169401 | pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf; |
| 169035 | 169402 | pTo->revLoop = revMask; |
| 169036 | 169403 | pTo->nRow = nOut; |
| 169037 | 169404 | pTo->rCost = rCost; |
| 169038 | | - pTo->rUnsorted = rUnsorted; |
| 169405 | + pTo->rUnsort = rUnsort; |
| 169039 | 169406 | pTo->isOrdered = isOrdered; |
| 169040 | 169407 | memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop); |
| 169041 | 169408 | pTo->aLoop[iLoop] = pWLoop; |
| 169042 | 169409 | if( nTo>=mxChoice ){ |
| 169043 | 169410 | mxI = 0; |
| 169044 | 169411 | mxCost = aTo[0].rCost; |
| 169045 | | - mxUnsorted = aTo[0].nRow; |
| 169412 | + mxUnsort = aTo[0].nRow; |
| 169046 | 169413 | for(jj=1, pTo=&aTo[1]; jj<mxChoice; jj++, pTo++){ |
| 169047 | 169414 | if( pTo->rCost>mxCost |
| 169048 | | - || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted) |
| 169415 | + || (pTo->rCost==mxCost && pTo->rUnsort>mxUnsort) |
| 169049 | 169416 | ){ |
| 169050 | 169417 | mxCost = pTo->rCost; |
| 169051 | | - mxUnsorted = pTo->rUnsorted; |
| 169418 | + mxUnsort = pTo->rUnsort; |
| 169052 | 169419 | mxI = jj; |
| 169053 | 169420 | } |
| 169054 | 169421 | } |
| 169055 | 169422 | } |
| 169056 | 169423 | } |
| | @@ -169058,12 +169425,14 @@ |
| 169058 | 169425 | |
| 169059 | 169426 | #ifdef WHERETRACE_ENABLED /* >=2 */ |
| 169060 | 169427 | if( sqlite3WhereTrace & 0x02 ){ |
| 169061 | 169428 | LogEst rMin, rFloor = 0; |
| 169062 | 169429 | int nDone = 0; |
| 169430 | + int nProgress; |
| 169063 | 169431 | sqlite3DebugPrintf("---- after round %d ----\n", iLoop); |
| 169064 | | - while( nDone<nTo ){ |
| 169432 | + do{ |
| 169433 | + nProgress = 0; |
| 169065 | 169434 | rMin = 0x7fff; |
| 169066 | 169435 | for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){ |
| 169067 | 169436 | if( pTo->rCost>rFloor && pTo->rCost<rMin ) rMin = pTo->rCost; |
| 169068 | 169437 | } |
| 169069 | 169438 | for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){ |
| | @@ -169075,14 +169444,15 @@ |
| 169075 | 169444 | sqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop); |
| 169076 | 169445 | }else{ |
| 169077 | 169446 | sqlite3DebugPrintf("\n"); |
| 169078 | 169447 | } |
| 169079 | 169448 | nDone++; |
| 169449 | + nProgress++; |
| 169080 | 169450 | } |
| 169081 | 169451 | } |
| 169082 | 169452 | rFloor = rMin; |
| 169083 | | - } |
| 169453 | + }while( nDone<nTo && nProgress>0 ); |
| 169084 | 169454 | } |
| 169085 | 169455 | #endif |
| 169086 | 169456 | |
| 169087 | 169457 | /* Swap the roles of aFrom and aTo for the next generation */ |
| 169088 | 169458 | pFrom = aTo; |
| | @@ -169172,11 +169542,14 @@ |
| 169172 | 169542 | pWInfo->revMask = revMask; |
| 169173 | 169543 | } |
| 169174 | 169544 | } |
| 169175 | 169545 | } |
| 169176 | 169546 | |
| 169177 | | - pWInfo->nRowOut = pFrom->nRow + pWInfo->nOutStarDelta; |
| 169547 | + pWInfo->nRowOut = pFrom->nRow; |
| 169548 | +#ifdef WHERETRACE_ENABLED |
| 169549 | + pWInfo->rTotalCost = pFrom->rCost; |
| 169550 | +#endif |
| 169178 | 169551 | |
| 169179 | 169552 | /* Free temporary memory and return success */ |
| 169180 | 169553 | sqlite3StackFreeNN(pParse->db, pSpace); |
| 169181 | 169554 | return SQLITE_OK; |
| 169182 | 169555 | } |
| | @@ -169570,11 +169943,10 @@ |
| 169570 | 169943 | pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName, |
| 169571 | 169944 | (double)sqlite3LogEstToInt(pTab->nRowLogEst))); |
| 169572 | 169945 | } |
| 169573 | 169946 | } |
| 169574 | 169947 | nSearch += pLoop->nOut; |
| 169575 | | - if( pWInfo->nOutStarDelta ) nSearch += pLoop->rStarDelta; |
| 169576 | 169948 | } |
| 169577 | 169949 | } |
| 169578 | 169950 | |
| 169579 | 169951 | /* |
| 169580 | 169952 | ** The index pIdx is used by a query and contains one or more expressions. |
| | @@ -170053,11 +170425,12 @@ |
| 170053 | 170425 | goto whereBeginError; |
| 170054 | 170426 | } |
| 170055 | 170427 | assert( db->mallocFailed==0 ); |
| 170056 | 170428 | #ifdef WHERETRACE_ENABLED |
| 170057 | 170429 | if( sqlite3WhereTrace ){ |
| 170058 | | - sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); |
| 170430 | + sqlite3DebugPrintf("---- Solution cost=%d, nRow=%d", |
| 170431 | + pWInfo->rTotalCost, pWInfo->nRowOut); |
| 170059 | 170432 | if( pWInfo->nOBSat>0 ){ |
| 170060 | 170433 | sqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask); |
| 170061 | 170434 | } |
| 170062 | 170435 | switch( pWInfo->eDistinct ){ |
| 170063 | 170436 | case WHERE_DISTINCT_UNIQUE: { |
| | @@ -170414,10 +170787,11 @@ |
| 170414 | 170787 | int pc, |
| 170415 | 170788 | VdbeOp *pOp |
| 170416 | 170789 | ){ |
| 170417 | 170790 | if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; |
| 170418 | 170791 | sqlite3VdbePrintOp(0, pc, pOp); |
| 170792 | + sqlite3ShowWhereTerm(0); /* So compiler won't complain about unused func */ |
| 170419 | 170793 | } |
| 170420 | 170794 | #endif |
| 170421 | 170795 | |
| 170422 | 170796 | /* |
| 170423 | 170797 | ** Generate the end of the WHERE loop. See comments on |
| | @@ -172523,11 +172897,11 @@ |
| 172523 | 172897 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); |
| 172524 | 172898 | } |
| 172525 | 172899 | sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, |
| 172526 | 172900 | bInverse, regArg, pWin->regAccum); |
| 172527 | 172901 | sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); |
| 172528 | | - sqlite3VdbeChangeP5(v, (u8)nArg); |
| 172902 | + sqlite3VdbeChangeP5(v, (u16)nArg); |
| 172529 | 172903 | if( pWin->bExprArgs ){ |
| 172530 | 172904 | sqlite3ReleaseTempRange(pParse, regArg, nArg); |
| 172531 | 172905 | } |
| 172532 | 172906 | } |
| 172533 | 172907 | |
| | @@ -173907,10 +174281,15 @@ |
| 173907 | 174281 | ** to the original parse.y sources. |
| 173908 | 174282 | */ |
| 173909 | 174283 | |
| 173910 | 174284 | /* #include "sqliteInt.h" */ |
| 173911 | 174285 | |
| 174286 | +/* |
| 174287 | +** Verify that the pParse->isCreate field is set |
| 174288 | +*/ |
| 174289 | +#define ASSERT_IS_CREATE assert(pParse->isCreate) |
| 174290 | + |
| 173912 | 174291 | /* |
| 173913 | 174292 | ** Disable all error recovery processing in the parser push-down |
| 173914 | 174293 | ** automaton. |
| 173915 | 174294 | */ |
| 173916 | 174295 | #define YYNOERRORRECOVERY 1 |
| | @@ -173970,10 +174349,14 @@ |
| 173970 | 174349 | ** shared across database connections. |
| 173971 | 174350 | */ |
| 173972 | 174351 | static void disableLookaside(Parse *pParse){ |
| 173973 | 174352 | sqlite3 *db = pParse->db; |
| 173974 | 174353 | pParse->disableLookaside++; |
| 174354 | +#ifdef SQLITE_DEBUG |
| 174355 | + pParse->isCreate = 1; |
| 174356 | +#endif |
| 174357 | + memset(&pParse->u1.cr, 0, sizeof(pParse->u1.cr)); |
| 173975 | 174358 | DisableLookaside; |
| 173976 | 174359 | } |
| 173977 | 174360 | |
| 173978 | 174361 | #if !defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) \ |
| 173979 | 174362 | && defined(SQLITE_UDL_CAPABLE_PARSER) |
| | @@ -174310,11 +174693,12 @@ |
| 174310 | 174693 | #define TK_ASTERISK 180 |
| 174311 | 174694 | #define TK_SPAN 181 |
| 174312 | 174695 | #define TK_ERROR 182 |
| 174313 | 174696 | #define TK_QNUMBER 183 |
| 174314 | 174697 | #define TK_SPACE 184 |
| 174315 | | -#define TK_ILLEGAL 185 |
| 174698 | +#define TK_COMMENT 185 |
| 174699 | +#define TK_ILLEGAL 186 |
| 174316 | 174700 | #endif |
| 174317 | 174701 | /**************** End token definitions ***************************************/ |
| 174318 | 174702 | |
| 174319 | 174703 | /* The next sections is a series of control #defines. |
| 174320 | 174704 | ** various aspects of the generated parser. |
| | @@ -174375,35 +174759,35 @@ |
| 174375 | 174759 | #ifndef INTERFACE |
| 174376 | 174760 | # define INTERFACE 1 |
| 174377 | 174761 | #endif |
| 174378 | 174762 | /************* Begin control #defines *****************************************/ |
| 174379 | 174763 | #define YYCODETYPE unsigned short int |
| 174380 | | -#define YYNOCODE 322 |
| 174764 | +#define YYNOCODE 323 |
| 174381 | 174765 | #define YYACTIONTYPE unsigned short int |
| 174382 | 174766 | #define YYWILDCARD 102 |
| 174383 | 174767 | #define sqlite3ParserTOKENTYPE Token |
| 174384 | 174768 | typedef union { |
| 174385 | 174769 | int yyinit; |
| 174386 | 174770 | sqlite3ParserTOKENTYPE yy0; |
| 174387 | | - ExprList* yy14; |
| 174388 | | - With* yy59; |
| 174389 | | - Cte* yy67; |
| 174390 | | - Upsert* yy122; |
| 174391 | | - IdList* yy132; |
| 174392 | | - int yy144; |
| 174393 | | - const char* yy168; |
| 174394 | | - SrcList* yy203; |
| 174395 | | - Window* yy211; |
| 174396 | | - OnOrUsing yy269; |
| 174397 | | - struct TrigEvent yy286; |
| 174398 | | - struct {int value; int mask;} yy383; |
| 174399 | | - u32 yy391; |
| 174400 | | - TriggerStep* yy427; |
| 174401 | | - Expr* yy454; |
| 174402 | | - u8 yy462; |
| 174403 | | - struct FrameBound yy509; |
| 174404 | | - Select* yy555; |
| 174771 | + u32 yy9; |
| 174772 | + struct TrigEvent yy28; |
| 174773 | + With* yy125; |
| 174774 | + IdList* yy204; |
| 174775 | + struct FrameBound yy205; |
| 174776 | + TriggerStep* yy319; |
| 174777 | + const char* yy342; |
| 174778 | + Cte* yy361; |
| 174779 | + ExprList* yy402; |
| 174780 | + Upsert* yy403; |
| 174781 | + OnOrUsing yy421; |
| 174782 | + u8 yy444; |
| 174783 | + struct {int value; int mask;} yy481; |
| 174784 | + Window* yy483; |
| 174785 | + int yy502; |
| 174786 | + SrcList* yy563; |
| 174787 | + Expr* yy590; |
| 174788 | + Select* yy637; |
| 174405 | 174789 | } YYMINORTYPE; |
| 174406 | 174790 | #ifndef YYSTACKDEPTH |
| 174407 | 174791 | #define YYSTACKDEPTH 100 |
| 174408 | 174792 | #endif |
| 174409 | 174793 | #define sqlite3ParserARG_SDECL |
| | @@ -174421,21 +174805,21 @@ |
| 174421 | 174805 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 174422 | 174806 | #define YYFALLBACK 1 |
| 174423 | 174807 | #define YYNSTATE 583 |
| 174424 | 174808 | #define YYNRULE 409 |
| 174425 | 174809 | #define YYNRULE_WITH_ACTION 344 |
| 174426 | | -#define YYNTOKEN 186 |
| 174810 | +#define YYNTOKEN 187 |
| 174427 | 174811 | #define YY_MAX_SHIFT 582 |
| 174428 | 174812 | #define YY_MIN_SHIFTREDUCE 845 |
| 174429 | 174813 | #define YY_MAX_SHIFTREDUCE 1253 |
| 174430 | 174814 | #define YY_ERROR_ACTION 1254 |
| 174431 | 174815 | #define YY_ACCEPT_ACTION 1255 |
| 174432 | 174816 | #define YY_NO_ACTION 1256 |
| 174433 | 174817 | #define YY_MIN_REDUCE 1257 |
| 174434 | 174818 | #define YY_MAX_REDUCE 1665 |
| 174435 | | -#define YY_MIN_DSTRCTR 205 |
| 174436 | | -#define YY_MAX_DSTRCTR 319 |
| 174819 | +#define YY_MIN_DSTRCTR 206 |
| 174820 | +#define YY_MAX_DSTRCTR 320 |
| 174437 | 174821 | /************* End control #defines *******************************************/ |
| 174438 | 174822 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 174439 | 174823 | |
| 174440 | 174824 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 174441 | 174825 | ** otherwise. |
| | @@ -174527,573 +174911,573 @@ |
| 174527 | 174911 | /* 60 */ 288, 288, 182, 288, 288, 481, 536, 288, 288, 130, |
| 174528 | 174912 | /* 70 */ 127, 234, 432, 573, 525, 562, 573, 557, 562, 1290, |
| 174529 | 174913 | /* 80 */ 573, 421, 562, 137, 138, 91, 559, 1228, 1228, 1063, |
| 174530 | 174914 | /* 90 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 296, |
| 174531 | 174915 | /* 100 */ 460, 398, 1249, 134, 134, 134, 134, 133, 133, 132, |
| 174532 | | - /* 110 */ 132, 132, 131, 128, 451, 44, 1050, 1050, 1064, 1067, |
| 174916 | + /* 110 */ 132, 132, 131, 128, 451, 451, 1050, 1050, 1064, 1067, |
| 174533 | 174917 | /* 120 */ 1255, 1, 1, 582, 2, 1259, 581, 1174, 1259, 1174, |
| 174534 | | - /* 130 */ 321, 413, 155, 321, 1584, 155, 379, 112, 498, 1341, |
| 174918 | + /* 130 */ 321, 413, 155, 321, 1584, 155, 379, 112, 481, 1341, |
| 174535 | 174919 | /* 140 */ 456, 299, 1341, 134, 134, 134, 134, 133, 133, 132, |
| 174536 | | - /* 150 */ 132, 132, 131, 128, 451, 137, 138, 91, 1105, 1228, |
| 174920 | + /* 150 */ 132, 132, 131, 128, 451, 137, 138, 91, 498, 1228, |
| 174537 | 174921 | /* 160 */ 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, |
| 174538 | | - /* 170 */ 136, 1204, 320, 567, 288, 288, 283, 288, 288, 523, |
| 174539 | | - /* 180 */ 523, 1250, 139, 1541, 7, 214, 503, 573, 1169, 562, |
| 174540 | | - /* 190 */ 573, 1054, 562, 136, 136, 136, 136, 129, 401, 547, |
| 174541 | | - /* 200 */ 487, 1169, 245, 1568, 1169, 245, 133, 133, 132, 132, |
| 174542 | | - /* 210 */ 132, 131, 128, 451, 261, 134, 134, 134, 134, 133, |
| 174543 | | - /* 220 */ 133, 132, 132, 132, 131, 128, 451, 451, 1204, 1205, |
| 174544 | | - /* 230 */ 1204, 130, 127, 234, 455, 413, 182, 455, 130, 127, |
| 174922 | + /* 170 */ 136, 1204, 862, 1281, 288, 288, 283, 288, 288, 523, |
| 174923 | + /* 180 */ 523, 1250, 139, 578, 7, 578, 1345, 573, 1169, 562, |
| 174924 | + /* 190 */ 573, 1054, 562, 136, 136, 136, 136, 129, 573, 547, |
| 174925 | + /* 200 */ 562, 1169, 245, 1541, 1169, 245, 133, 133, 132, 132, |
| 174926 | + /* 210 */ 132, 131, 128, 451, 302, 134, 134, 134, 134, 133, |
| 174927 | + /* 220 */ 133, 132, 132, 132, 131, 128, 451, 1575, 1204, 1205, |
| 174928 | + /* 230 */ 1204, 7, 470, 550, 455, 413, 550, 455, 130, 127, |
| 174545 | 174929 | /* 240 */ 234, 134, 134, 134, 134, 133, 133, 132, 132, 132, |
| 174546 | | - /* 250 */ 131, 128, 451, 136, 136, 136, 136, 538, 576, 137, |
| 174547 | | - /* 260 */ 138, 91, 261, 1228, 1228, 1063, 1066, 1053, 1053, 135, |
| 174548 | | - /* 270 */ 135, 136, 136, 136, 136, 44, 472, 346, 1204, 472, |
| 174549 | | - /* 280 */ 346, 51, 51, 418, 93, 157, 134, 134, 134, 134, |
| 174550 | | - /* 290 */ 133, 133, 132, 132, 132, 131, 128, 451, 166, 363, |
| 174551 | | - /* 300 */ 298, 134, 134, 134, 134, 133, 133, 132, 132, 132, |
| 174552 | | - /* 310 */ 131, 128, 451, 1293, 461, 1570, 423, 377, 275, 134, |
| 174930 | + /* 250 */ 131, 128, 451, 136, 136, 136, 136, 538, 483, 137, |
| 174931 | + /* 260 */ 138, 91, 1019, 1228, 1228, 1063, 1066, 1053, 1053, 135, |
| 174932 | + /* 270 */ 135, 136, 136, 136, 136, 1085, 576, 1204, 132, 132, |
| 174933 | + /* 280 */ 132, 131, 128, 451, 93, 214, 134, 134, 134, 134, |
| 174934 | + /* 290 */ 133, 133, 132, 132, 132, 131, 128, 451, 401, 19, |
| 174935 | + /* 300 */ 19, 134, 134, 134, 134, 133, 133, 132, 132, 132, |
| 174936 | + /* 310 */ 131, 128, 451, 1498, 426, 267, 344, 467, 332, 134, |
| 174553 | 174937 | /* 320 */ 134, 134, 134, 133, 133, 132, 132, 132, 131, 128, |
| 174554 | | - /* 330 */ 451, 418, 320, 567, 1292, 1204, 1205, 1204, 257, 413, |
| 174555 | | - /* 340 */ 483, 511, 508, 507, 94, 132, 132, 132, 131, 128, |
| 174556 | | - /* 350 */ 451, 506, 1204, 548, 548, 388, 576, 384, 7, 413, |
| 174557 | | - /* 360 */ 550, 229, 522, 137, 138, 91, 530, 1228, 1228, 1063, |
| 174558 | | - /* 370 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 51, |
| 174559 | | - /* 380 */ 51, 1582, 380, 137, 138, 91, 331, 1228, 1228, 1063, |
| 174560 | | - /* 390 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 320, |
| 174561 | | - /* 400 */ 567, 288, 288, 320, 567, 1602, 582, 2, 1259, 1204, |
| 174562 | | - /* 410 */ 1205, 1204, 1628, 321, 573, 155, 562, 576, 1511, 264, |
| 174563 | | - /* 420 */ 231, 520, 1341, 134, 134, 134, 134, 133, 133, 132, |
| 174564 | | - /* 430 */ 132, 132, 131, 128, 451, 519, 1511, 1513, 1333, 1333, |
| 174565 | | - /* 440 */ 82, 82, 498, 134, 134, 134, 134, 133, 133, 132, |
| 174566 | | - /* 450 */ 132, 132, 131, 128, 451, 1435, 257, 288, 288, 511, |
| 174567 | | - /* 460 */ 508, 507, 944, 1568, 413, 1019, 1204, 943, 360, 506, |
| 174568 | | - /* 470 */ 573, 1598, 562, 44, 575, 551, 551, 557, 1107, 1582, |
| 174569 | | - /* 480 */ 544, 576, 1107, 40, 417, 245, 531, 1505, 137, 138, |
| 174938 | + /* 330 */ 451, 1281, 576, 6, 1204, 1205, 1204, 257, 576, 413, |
| 174939 | + /* 340 */ 511, 508, 507, 1279, 94, 1019, 464, 1204, 551, 551, |
| 174940 | + /* 350 */ 506, 1224, 1571, 44, 38, 51, 51, 411, 576, 413, |
| 174941 | + /* 360 */ 45, 51, 51, 137, 138, 91, 530, 1228, 1228, 1063, |
| 174942 | + /* 370 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 398, |
| 174943 | + /* 380 */ 1148, 82, 82, 137, 138, 91, 39, 1228, 1228, 1063, |
| 174944 | + /* 390 */ 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, 344, |
| 174945 | + /* 400 */ 44, 288, 288, 375, 1204, 1205, 1204, 209, 1204, 1224, |
| 174946 | + /* 410 */ 320, 567, 471, 576, 573, 576, 562, 576, 316, 264, |
| 174947 | + /* 420 */ 231, 46, 160, 134, 134, 134, 134, 133, 133, 132, |
| 174948 | + /* 430 */ 132, 132, 131, 128, 451, 303, 82, 82, 82, 82, |
| 174949 | + /* 440 */ 82, 82, 442, 134, 134, 134, 134, 133, 133, 132, |
| 174950 | + /* 450 */ 132, 132, 131, 128, 451, 1582, 544, 320, 567, 1250, |
| 174951 | + /* 460 */ 874, 1582, 380, 382, 413, 1204, 1205, 1204, 360, 182, |
| 174952 | + /* 470 */ 288, 288, 1576, 557, 1339, 557, 7, 557, 1277, 472, |
| 174953 | + /* 480 */ 346, 526, 531, 573, 556, 562, 439, 1511, 137, 138, |
| 174570 | 174954 | /* 490 */ 91, 219, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, |
| 174571 | | - /* 500 */ 136, 136, 136, 136, 81, 81, 1281, 1204, 413, 553, |
| 174572 | | - /* 510 */ 1511, 48, 512, 448, 447, 493, 578, 455, 578, 344, |
| 174573 | | - /* 520 */ 45, 1204, 1233, 1204, 1205, 1204, 428, 1235, 158, 882, |
| 174574 | | - /* 530 */ 320, 567, 137, 138, 91, 1234, 1228, 1228, 1063, 1066, |
| 174955 | + /* 500 */ 136, 136, 136, 136, 465, 1511, 1513, 532, 413, 288, |
| 174956 | + /* 510 */ 288, 423, 512, 288, 288, 411, 288, 288, 874, 130, |
| 174957 | + /* 520 */ 127, 234, 573, 1107, 562, 1204, 573, 1107, 562, 573, |
| 174958 | + /* 530 */ 560, 562, 137, 138, 91, 1293, 1228, 1228, 1063, 1066, |
| 174575 | 174959 | /* 540 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 134, 134, |
| 174576 | 174960 | /* 550 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 451, |
| 174577 | | - /* 560 */ 1236, 576, 1236, 329, 1204, 1205, 1204, 387, 492, 403, |
| 174578 | | - /* 570 */ 1040, 382, 489, 123, 568, 1569, 4, 377, 1204, 1205, |
| 174579 | | - /* 580 */ 1204, 570, 570, 570, 82, 82, 882, 1029, 1331, 1331, |
| 174580 | | - /* 590 */ 571, 1028, 134, 134, 134, 134, 133, 133, 132, 132, |
| 174581 | | - /* 600 */ 132, 131, 128, 451, 288, 288, 1281, 1204, 576, 423, |
| 174582 | | - /* 610 */ 576, 1568, 413, 423, 452, 378, 886, 573, 1279, 562, |
| 174583 | | - /* 620 */ 46, 557, 532, 1028, 1028, 1030, 565, 130, 127, 234, |
| 174584 | | - /* 630 */ 556, 82, 82, 82, 82, 479, 137, 138, 91, 462, |
| 174961 | + /* 560 */ 493, 503, 1292, 1204, 257, 288, 288, 511, 508, 507, |
| 174962 | + /* 570 */ 1204, 1628, 1169, 123, 568, 275, 4, 506, 573, 1511, |
| 174963 | + /* 580 */ 562, 331, 1204, 1205, 1204, 1169, 548, 548, 1169, 261, |
| 174964 | + /* 590 */ 571, 7, 134, 134, 134, 134, 133, 133, 132, 132, |
| 174965 | + /* 600 */ 132, 131, 128, 451, 108, 533, 130, 127, 234, 1204, |
| 174966 | + /* 610 */ 448, 447, 413, 1451, 452, 983, 886, 96, 1598, 1233, |
| 174967 | + /* 620 */ 1204, 1205, 1204, 984, 1235, 1450, 565, 1204, 1205, 1204, |
| 174968 | + /* 630 */ 229, 522, 1234, 534, 1333, 1333, 137, 138, 91, 1449, |
| 174585 | 174969 | /* 640 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136, |
| 174586 | | - /* 650 */ 136, 136, 1188, 487, 1506, 1040, 413, 6, 1204, 50, |
| 174587 | | - /* 660 */ 879, 121, 121, 948, 1204, 1205, 1204, 358, 557, 122, |
| 174588 | | - /* 670 */ 316, 452, 577, 452, 535, 1204, 1028, 439, 303, 212, |
| 174589 | | - /* 680 */ 137, 138, 91, 213, 1228, 1228, 1063, 1066, 1053, 1053, |
| 174970 | + /* 650 */ 136, 136, 373, 1595, 971, 1040, 413, 1236, 418, 1236, |
| 174971 | + /* 660 */ 879, 121, 121, 948, 373, 1595, 1204, 1205, 1204, 122, |
| 174972 | + /* 670 */ 1204, 452, 577, 452, 363, 417, 1028, 882, 373, 1595, |
| 174973 | + /* 680 */ 137, 138, 91, 462, 1228, 1228, 1063, 1066, 1053, 1053, |
| 174590 | 174974 | /* 690 */ 135, 135, 136, 136, 136, 136, 134, 134, 134, 134, |
| 174591 | 174975 | /* 700 */ 133, 133, 132, 132, 132, 131, 128, 451, 1028, 1028, |
| 174592 | | - /* 710 */ 1030, 1031, 35, 288, 288, 1204, 1205, 1204, 1040, 1339, |
| 174593 | | - /* 720 */ 533, 123, 568, 1569, 4, 377, 573, 1019, 562, 353, |
| 174594 | | - /* 730 */ 1277, 356, 1204, 1205, 1204, 1029, 488, 1188, 571, 1028, |
| 174976 | + /* 710 */ 1030, 1031, 35, 570, 570, 570, 197, 423, 1040, 198, |
| 174977 | + /* 720 */ 1204, 123, 568, 1204, 4, 320, 567, 1204, 1205, 1204, |
| 174978 | + /* 730 */ 40, 388, 576, 384, 882, 1029, 423, 1188, 571, 1028, |
| 174595 | 174979 | /* 740 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131, |
| 174596 | | - /* 750 */ 128, 451, 576, 343, 288, 288, 449, 449, 449, 971, |
| 174597 | | - /* 760 */ 413, 1627, 452, 911, 1187, 288, 288, 573, 464, 562, |
| 174598 | | - /* 770 */ 238, 1028, 1028, 1030, 565, 82, 82, 498, 573, 411, |
| 174599 | | - /* 780 */ 562, 344, 467, 332, 137, 138, 91, 197, 1228, 1228, |
| 174980 | + /* 750 */ 128, 451, 529, 1568, 1204, 19, 19, 1204, 575, 492, |
| 174981 | + /* 760 */ 413, 157, 452, 489, 1187, 1331, 1331, 5, 1204, 949, |
| 174982 | + /* 770 */ 431, 1028, 1028, 1030, 565, 22, 22, 1204, 1205, 1204, |
| 174983 | + /* 780 */ 1204, 1205, 1204, 477, 137, 138, 91, 212, 1228, 1228, |
| 174600 | 174984 | /* 790 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, |
| 174601 | | - /* 800 */ 1188, 528, 1169, 1040, 413, 1110, 1110, 495, 1041, 121, |
| 174602 | | - /* 810 */ 121, 1204, 317, 540, 862, 1169, 1244, 122, 1169, 452, |
| 174603 | | - /* 820 */ 577, 452, 1340, 198, 1028, 1204, 481, 526, 137, 138, |
| 174604 | | - /* 830 */ 91, 560, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, |
| 174985 | + /* 800 */ 1188, 48, 111, 1040, 413, 1204, 213, 970, 1041, 121, |
| 174986 | + /* 810 */ 121, 1204, 1205, 1204, 1204, 1205, 1204, 122, 221, 452, |
| 174987 | + /* 820 */ 577, 452, 44, 487, 1028, 1204, 1205, 1204, 137, 138, |
| 174988 | + /* 830 */ 91, 378, 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, |
| 174605 | 174989 | /* 840 */ 136, 136, 136, 136, 134, 134, 134, 134, 133, 133, |
| 174606 | 174990 | /* 850 */ 132, 132, 132, 131, 128, 451, 1028, 1028, 1030, 1031, |
| 174607 | | - /* 860 */ 35, 1204, 288, 288, 1204, 477, 288, 288, 1204, 1205, |
| 174608 | | - /* 870 */ 1204, 539, 481, 437, 470, 573, 1451, 562, 364, 573, |
| 174609 | | - /* 880 */ 1153, 562, 1204, 1205, 1204, 1188, 5, 576, 134, 134, |
| 174991 | + /* 860 */ 35, 461, 1204, 1205, 1204, 1569, 1040, 377, 214, 1149, |
| 174992 | + /* 870 */ 1657, 535, 1657, 437, 902, 320, 567, 1568, 364, 320, |
| 174993 | + /* 880 */ 567, 412, 329, 1029, 519, 1188, 3, 1028, 134, 134, |
| 174610 | 174994 | /* 890 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 451, |
| 174611 | | - /* 900 */ 221, 214, 302, 96, 1149, 1657, 232, 1657, 413, 392, |
| 174612 | | - /* 910 */ 19, 19, 1024, 949, 406, 373, 1595, 1085, 1204, 1205, |
| 174613 | | - /* 920 */ 1204, 1204, 1205, 1204, 1204, 426, 1149, 1658, 413, 1658, |
| 174614 | | - /* 930 */ 1659, 399, 137, 138, 91, 3, 1228, 1228, 1063, 1066, |
| 174615 | | - /* 940 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 304, 1311, |
| 174616 | | - /* 950 */ 514, 1204, 137, 138, 91, 1498, 1228, 1228, 1063, 1066, |
| 174617 | | - /* 960 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 434, 131, |
| 174618 | | - /* 970 */ 128, 451, 375, 1204, 274, 291, 372, 517, 367, 516, |
| 174619 | | - /* 980 */ 262, 1204, 1205, 1204, 1147, 227, 363, 448, 447, 1435, |
| 174620 | | - /* 990 */ 1568, 1310, 134, 134, 134, 134, 133, 133, 132, 132, |
| 174621 | | - /* 1000 */ 132, 131, 128, 451, 1568, 576, 1147, 487, 1204, 1205, |
| 174622 | | - /* 1010 */ 1204, 442, 134, 134, 134, 134, 133, 133, 132, 132, |
| 174623 | | - /* 1020 */ 132, 131, 128, 451, 386, 576, 485, 576, 19, 19, |
| 174624 | | - /* 1030 */ 1204, 1205, 1204, 1345, 1236, 970, 1236, 574, 47, 936, |
| 174625 | | - /* 1040 */ 936, 473, 413, 431, 1552, 573, 1125, 562, 19, 19, |
| 174626 | | - /* 1050 */ 19, 19, 49, 336, 850, 851, 852, 111, 1368, 315, |
| 174627 | | - /* 1060 */ 429, 576, 413, 433, 341, 306, 137, 138, 91, 115, |
| 174995 | + /* 900 */ 1659, 399, 1169, 307, 893, 307, 515, 576, 413, 214, |
| 174996 | + /* 910 */ 498, 944, 1024, 540, 903, 1169, 943, 392, 1169, 1028, |
| 174997 | + /* 920 */ 1028, 1030, 406, 298, 1204, 50, 1149, 1658, 413, 1658, |
| 174998 | + /* 930 */ 145, 145, 137, 138, 91, 293, 1228, 1228, 1063, 1066, |
| 174999 | + /* 940 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 1188, 1147, |
| 175000 | + /* 950 */ 514, 1568, 137, 138, 91, 1505, 1228, 1228, 1063, 1066, |
| 175001 | + /* 960 */ 1053, 1053, 135, 135, 136, 136, 136, 136, 434, 323, |
| 175002 | + /* 970 */ 435, 539, 111, 1506, 274, 291, 372, 517, 367, 516, |
| 175003 | + /* 980 */ 262, 1204, 1205, 1204, 1574, 481, 363, 576, 7, 1569, |
| 175004 | + /* 990 */ 1568, 377, 134, 134, 134, 134, 133, 133, 132, 132, |
| 175005 | + /* 1000 */ 132, 131, 128, 451, 1568, 576, 1147, 576, 232, 576, |
| 175006 | + /* 1010 */ 19, 19, 134, 134, 134, 134, 133, 133, 132, 132, |
| 175007 | + /* 1020 */ 132, 131, 128, 451, 1169, 433, 576, 1207, 19, 19, |
| 175008 | + /* 1030 */ 19, 19, 19, 19, 1627, 576, 911, 1169, 47, 120, |
| 175009 | + /* 1040 */ 1169, 117, 413, 306, 498, 438, 1125, 206, 336, 19, |
| 175010 | + /* 1050 */ 19, 1435, 49, 449, 449, 449, 1368, 315, 81, 81, |
| 175011 | + /* 1060 */ 576, 304, 413, 1570, 207, 377, 137, 138, 91, 115, |
| 174628 | 175012 | /* 1070 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136, |
| 174629 | | - /* 1080 */ 136, 136, 576, 1309, 82, 82, 137, 138, 91, 529, |
| 175013 | + /* 1080 */ 136, 136, 576, 82, 82, 1207, 137, 138, 91, 1340, |
| 174630 | 175014 | /* 1090 */ 1228, 1228, 1063, 1066, 1053, 1053, 135, 135, 136, 136, |
| 174631 | | - /* 1100 */ 136, 136, 1569, 222, 377, 19, 19, 305, 1126, 1169, |
| 174632 | | - /* 1110 */ 398, 1148, 22, 22, 498, 333, 1569, 335, 377, 576, |
| 174633 | | - /* 1120 */ 438, 445, 1169, 1127, 486, 1169, 134, 134, 134, 134, |
| 175015 | + /* 1100 */ 136, 136, 1569, 386, 377, 82, 82, 463, 1126, 1552, |
| 175016 | + /* 1110 */ 333, 463, 335, 131, 128, 451, 1569, 161, 377, 16, |
| 175017 | + /* 1120 */ 317, 387, 428, 1127, 448, 447, 134, 134, 134, 134, |
| 174634 | 175018 | /* 1130 */ 133, 133, 132, 132, 132, 131, 128, 451, 1128, 576, |
| 174635 | | - /* 1140 */ 902, 576, 145, 145, 6, 576, 134, 134, 134, 134, |
| 174636 | | - /* 1150 */ 133, 133, 132, 132, 132, 131, 128, 451, 214, 1336, |
| 174637 | | - /* 1160 */ 922, 576, 19, 19, 19, 19, 1282, 419, 19, 19, |
| 174638 | | - /* 1170 */ 923, 412, 515, 141, 576, 1169, 413, 206, 465, 207, |
| 174639 | | - /* 1180 */ 903, 215, 1575, 552, 147, 147, 7, 227, 1169, 411, |
| 174640 | | - /* 1190 */ 1250, 1169, 120, 307, 117, 307, 413, 66, 66, 334, |
| 175019 | + /* 1140 */ 1105, 10, 445, 267, 576, 1554, 134, 134, 134, 134, |
| 175020 | + /* 1150 */ 133, 133, 132, 132, 132, 131, 128, 451, 532, 576, |
| 175021 | + /* 1160 */ 922, 576, 19, 19, 576, 1573, 576, 147, 147, 7, |
| 175022 | + /* 1170 */ 923, 1236, 498, 1236, 576, 487, 413, 552, 285, 1224, |
| 175023 | + /* 1180 */ 969, 215, 82, 82, 66, 66, 1435, 67, 67, 21, |
| 175024 | + /* 1190 */ 21, 1110, 1110, 495, 334, 297, 413, 53, 53, 297, |
| 174641 | 175025 | /* 1200 */ 137, 138, 91, 119, 1228, 1228, 1063, 1066, 1053, 1053, |
| 174642 | | - /* 1210 */ 135, 135, 136, 136, 136, 136, 413, 285, 209, 969, |
| 174643 | | - /* 1220 */ 137, 138, 91, 471, 1228, 1228, 1063, 1066, 1053, 1053, |
| 174644 | | - /* 1230 */ 135, 135, 136, 136, 136, 136, 435, 10, 1450, 267, |
| 174645 | | - /* 1240 */ 137, 126, 91, 1435, 1228, 1228, 1063, 1066, 1053, 1053, |
| 174646 | | - /* 1250 */ 135, 135, 136, 136, 136, 136, 1435, 1435, 410, 409, |
| 175026 | + /* 1210 */ 135, 135, 136, 136, 136, 136, 413, 1336, 1311, 446, |
| 175027 | + /* 1220 */ 137, 138, 91, 227, 1228, 1228, 1063, 1066, 1053, 1053, |
| 175028 | + /* 1230 */ 135, 135, 136, 136, 136, 136, 574, 1224, 936, 936, |
| 175029 | + /* 1240 */ 137, 126, 91, 141, 1228, 1228, 1063, 1066, 1053, 1053, |
| 175030 | + /* 1250 */ 135, 135, 136, 136, 136, 136, 533, 429, 472, 346, |
| 174647 | 175031 | /* 1260 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131, |
| 174648 | | - /* 1270 */ 128, 451, 576, 969, 576, 1224, 498, 373, 1595, 1554, |
| 175032 | + /* 1270 */ 128, 451, 576, 457, 233, 343, 1435, 403, 498, 1550, |
| 174649 | 175033 | /* 1280 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131, |
| 174650 | | - /* 1290 */ 128, 451, 532, 457, 576, 82, 82, 82, 82, 111, |
| 175034 | + /* 1290 */ 128, 451, 576, 324, 576, 82, 82, 487, 576, 969, |
| 174651 | 175035 | /* 1300 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131, |
| 174652 | | - /* 1310 */ 128, 451, 109, 233, 430, 1576, 546, 67, 67, 7, |
| 174653 | | - /* 1320 */ 413, 351, 550, 1550, 260, 259, 258, 494, 443, 569, |
| 174654 | | - /* 1330 */ 419, 983, 446, 1224, 450, 545, 1207, 576, 969, 984, |
| 174655 | | - /* 1340 */ 413, 475, 1449, 1574, 1180, 138, 91, 7, 1228, 1228, |
| 175036 | + /* 1310 */ 128, 451, 288, 288, 546, 68, 68, 54, 54, 553, |
| 175037 | + /* 1320 */ 413, 69, 69, 351, 6, 573, 944, 562, 410, 409, |
| 175038 | + /* 1330 */ 1435, 943, 450, 545, 260, 259, 258, 576, 158, 576, |
| 175039 | + /* 1340 */ 413, 222, 1180, 479, 969, 138, 91, 430, 1228, 1228, |
| 174656 | 175040 | /* 1350 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, |
| 174657 | | - /* 1360 */ 21, 21, 267, 576, 300, 1126, 91, 233, 1228, 1228, |
| 175041 | + /* 1360 */ 70, 70, 71, 71, 576, 1126, 91, 576, 1228, 1228, |
| 174658 | 175042 | /* 1370 */ 1063, 1066, 1053, 1053, 135, 135, 136, 136, 136, 136, |
| 174659 | | - /* 1380 */ 1127, 373, 1595, 161, 1573, 16, 53, 53, 7, 108, |
| 174660 | | - /* 1390 */ 533, 38, 969, 125, 1207, 1128, 1180, 576, 1224, 123, |
| 174661 | | - /* 1400 */ 568, 893, 4, 324, 134, 134, 134, 134, 133, 133, |
| 174662 | | - /* 1410 */ 132, 132, 132, 131, 128, 451, 571, 564, 534, 576, |
| 174663 | | - /* 1420 */ 68, 68, 576, 39, 134, 134, 134, 134, 133, 133, |
| 174664 | | - /* 1430 */ 132, 132, 132, 131, 128, 451, 576, 160, 1571, 1223, |
| 174665 | | - /* 1440 */ 452, 576, 54, 54, 576, 69, 69, 576, 1366, 576, |
| 174666 | | - /* 1450 */ 420, 184, 565, 463, 297, 576, 1224, 463, 297, 70, |
| 174667 | | - /* 1460 */ 70, 576, 44, 474, 71, 71, 576, 72, 72, 576, |
| 174668 | | - /* 1470 */ 73, 73, 55, 55, 411, 874, 242, 576, 56, 56, |
| 174669 | | - /* 1480 */ 576, 1040, 576, 478, 57, 57, 576, 121, 121, 59, |
| 174670 | | - /* 1490 */ 59, 23, 60, 60, 411, 122, 319, 452, 577, 452, |
| 174671 | | - /* 1500 */ 74, 74, 1028, 75, 75, 76, 76, 411, 290, 20, |
| 174672 | | - /* 1510 */ 20, 108, 287, 231, 553, 123, 568, 325, 4, 320, |
| 174673 | | - /* 1520 */ 567, 97, 218, 944, 1144, 328, 400, 576, 943, 576, |
| 174674 | | - /* 1530 */ 1380, 424, 571, 874, 1028, 1028, 1030, 1031, 35, 293, |
| 174675 | | - /* 1540 */ 534, 576, 1104, 576, 1104, 9, 576, 342, 576, 111, |
| 174676 | | - /* 1550 */ 77, 77, 143, 143, 576, 205, 452, 222, 1379, 889, |
| 174677 | | - /* 1560 */ 576, 901, 900, 1188, 144, 144, 78, 78, 565, 62, |
| 174678 | | - /* 1570 */ 62, 79, 79, 323, 1021, 576, 266, 63, 63, 908, |
| 174679 | | - /* 1580 */ 909, 1589, 542, 80, 80, 576, 371, 541, 123, 568, |
| 174680 | | - /* 1590 */ 480, 4, 266, 482, 244, 266, 370, 1040, 64, 64, |
| 174681 | | - /* 1600 */ 576, 466, 576, 121, 121, 571, 1557, 576, 170, 170, |
| 174682 | | - /* 1610 */ 576, 122, 576, 452, 577, 452, 576, 889, 1028, 576, |
| 174683 | | - /* 1620 */ 165, 576, 111, 171, 171, 87, 87, 337, 1616, 452, |
| 174684 | | - /* 1630 */ 65, 65, 1530, 83, 83, 146, 146, 986, 987, 84, |
| 174685 | | - /* 1640 */ 84, 565, 168, 168, 148, 148, 1092, 347, 1032, 111, |
| 174686 | | - /* 1650 */ 1028, 1028, 1030, 1031, 35, 542, 1103, 576, 1103, 576, |
| 174687 | | - /* 1660 */ 543, 123, 568, 504, 4, 263, 576, 361, 1529, 111, |
| 174688 | | - /* 1670 */ 1040, 1088, 576, 263, 576, 490, 121, 121, 571, 1188, |
| 174689 | | - /* 1680 */ 142, 142, 169, 169, 122, 576, 452, 577, 452, 162, |
| 174690 | | - /* 1690 */ 162, 1028, 576, 563, 576, 152, 152, 151, 151, 348, |
| 174691 | | - /* 1700 */ 1376, 974, 452, 266, 1092, 942, 1032, 125, 149, 149, |
| 174692 | | - /* 1710 */ 939, 576, 125, 576, 565, 150, 150, 86, 86, 872, |
| 174693 | | - /* 1720 */ 352, 159, 576, 1028, 1028, 1030, 1031, 35, 542, 941, |
| 174694 | | - /* 1730 */ 576, 125, 355, 541, 88, 88, 85, 85, 357, 359, |
| 174695 | | - /* 1740 */ 1324, 1308, 366, 1040, 376, 52, 52, 499, 1389, 121, |
| 174696 | | - /* 1750 */ 121, 1434, 1188, 58, 58, 1362, 1374, 122, 1439, 452, |
| 174697 | | - /* 1760 */ 577, 452, 1289, 167, 1028, 1280, 280, 1268, 1267, 1269, |
| 174698 | | - /* 1770 */ 1609, 1359, 312, 313, 12, 314, 397, 1421, 224, 1416, |
| 174699 | | - /* 1780 */ 295, 237, 1409, 339, 340, 1426, 301, 345, 484, 228, |
| 174700 | | - /* 1790 */ 1371, 1307, 1372, 1370, 1425, 404, 1028, 1028, 1030, 1031, |
| 174701 | | - /* 1800 */ 35, 1601, 1192, 454, 509, 369, 292, 1502, 210, 1501, |
| 174702 | | - /* 1810 */ 1369, 396, 396, 395, 277, 393, 211, 566, 859, 1612, |
| 174703 | | - /* 1820 */ 1244, 123, 568, 391, 4, 1188, 223, 270, 1549, 1547, |
| 174704 | | - /* 1830 */ 1241, 239, 186, 327, 422, 96, 195, 220, 571, 235, |
| 174705 | | - /* 1840 */ 180, 326, 188, 468, 190, 1507, 191, 192, 92, 193, |
| 174706 | | - /* 1850 */ 469, 95, 1422, 13, 502, 247, 1430, 109, 199, 402, |
| 174707 | | - /* 1860 */ 476, 405, 452, 1496, 1428, 1427, 14, 491, 251, 102, |
| 174708 | | - /* 1870 */ 497, 1518, 241, 281, 565, 253, 203, 354, 500, 254, |
| 174709 | | - /* 1880 */ 175, 1270, 407, 43, 350, 518, 1327, 436, 255, 1326, |
| 174710 | | - /* 1890 */ 1325, 1318, 104, 893, 1626, 229, 408, 440, 1625, 441, |
| 174711 | | - /* 1900 */ 240, 310, 1296, 1040, 311, 1317, 527, 1594, 1297, 121, |
| 174712 | | - /* 1910 */ 121, 368, 1295, 1624, 268, 269, 1580, 122, 1579, 452, |
| 174713 | | - /* 1920 */ 577, 452, 374, 444, 1028, 1394, 1393, 140, 553, 90, |
| 174714 | | - /* 1930 */ 568, 11, 4, 1483, 383, 414, 385, 110, 116, 216, |
| 174715 | | - /* 1940 */ 320, 567, 1350, 555, 42, 318, 571, 537, 1349, 389, |
| 174716 | | - /* 1950 */ 390, 579, 1198, 276, 279, 278, 1028, 1028, 1030, 1031, |
| 174717 | | - /* 1960 */ 35, 580, 415, 1265, 458, 1260, 416, 185, 1534, 172, |
| 174718 | | - /* 1970 */ 452, 1535, 173, 156, 308, 846, 1533, 1532, 453, 217, |
| 174719 | | - /* 1980 */ 225, 89, 565, 174, 322, 1188, 226, 236, 1102, 154, |
| 174720 | | - /* 1990 */ 1100, 330, 176, 187, 1223, 189, 925, 338, 243, 1116, |
| 174721 | | - /* 2000 */ 246, 194, 177, 178, 425, 427, 98, 99, 196, 100, |
| 174722 | | - /* 2010 */ 101, 1040, 179, 1119, 248, 1115, 249, 121, 121, 24, |
| 174723 | | - /* 2020 */ 163, 250, 349, 1108, 266, 122, 1238, 452, 577, 452, |
| 174724 | | - /* 2030 */ 1192, 454, 1028, 200, 292, 496, 252, 201, 861, 396, |
| 175043 | + /* 1380 */ 1127, 166, 850, 851, 852, 1282, 419, 72, 72, 108, |
| 175044 | + /* 1390 */ 73, 73, 1310, 358, 1180, 1128, 576, 305, 576, 123, |
| 175045 | + /* 1400 */ 568, 494, 4, 488, 134, 134, 134, 134, 133, 133, |
| 175046 | + /* 1410 */ 132, 132, 132, 131, 128, 451, 571, 564, 534, 55, |
| 175047 | + /* 1420 */ 55, 56, 56, 576, 134, 134, 134, 134, 133, 133, |
| 175048 | + /* 1430 */ 132, 132, 132, 131, 128, 451, 576, 1104, 233, 1104, |
| 175049 | + /* 1440 */ 452, 1602, 582, 2, 1259, 576, 57, 57, 576, 321, |
| 175050 | + /* 1450 */ 576, 155, 565, 1435, 485, 353, 576, 356, 1341, 59, |
| 175051 | + /* 1460 */ 59, 576, 44, 969, 569, 419, 576, 238, 60, 60, |
| 175052 | + /* 1470 */ 261, 74, 74, 75, 75, 287, 231, 576, 1366, 76, |
| 175053 | + /* 1480 */ 76, 1040, 420, 184, 20, 20, 576, 121, 121, 77, |
| 175054 | + /* 1490 */ 77, 97, 218, 288, 288, 122, 125, 452, 577, 452, |
| 175055 | + /* 1500 */ 143, 143, 1028, 576, 520, 576, 573, 576, 562, 144, |
| 175056 | + /* 1510 */ 144, 474, 227, 1244, 478, 123, 568, 576, 4, 320, |
| 175057 | + /* 1520 */ 567, 245, 411, 576, 443, 411, 78, 78, 62, 62, |
| 175058 | + /* 1530 */ 79, 79, 571, 319, 1028, 1028, 1030, 1031, 35, 418, |
| 175059 | + /* 1540 */ 63, 63, 576, 290, 411, 9, 80, 80, 1144, 576, |
| 175060 | + /* 1550 */ 400, 576, 486, 455, 576, 1223, 452, 576, 325, 342, |
| 175061 | + /* 1560 */ 576, 111, 576, 1188, 242, 64, 64, 473, 565, 576, |
| 175062 | + /* 1570 */ 23, 576, 170, 170, 171, 171, 576, 87, 87, 328, |
| 175063 | + /* 1580 */ 65, 65, 542, 83, 83, 146, 146, 541, 123, 568, |
| 175064 | + /* 1590 */ 341, 4, 84, 84, 168, 168, 576, 1040, 576, 148, |
| 175065 | + /* 1600 */ 148, 576, 1380, 121, 121, 571, 1021, 576, 266, 576, |
| 175066 | + /* 1610 */ 424, 122, 576, 452, 577, 452, 576, 553, 1028, 142, |
| 175067 | + /* 1620 */ 142, 169, 169, 576, 162, 162, 528, 889, 371, 452, |
| 175068 | + /* 1630 */ 152, 152, 151, 151, 1379, 149, 149, 109, 370, 150, |
| 175069 | + /* 1640 */ 150, 565, 576, 480, 576, 266, 86, 86, 576, 1092, |
| 175070 | + /* 1650 */ 1028, 1028, 1030, 1031, 35, 542, 482, 576, 266, 466, |
| 175071 | + /* 1660 */ 543, 123, 568, 1616, 4, 88, 88, 85, 85, 475, |
| 175072 | + /* 1670 */ 1040, 52, 52, 222, 901, 900, 121, 121, 571, 1188, |
| 175073 | + /* 1680 */ 58, 58, 244, 1032, 122, 889, 452, 577, 452, 908, |
| 175074 | + /* 1690 */ 909, 1028, 300, 347, 504, 111, 263, 361, 165, 111, |
| 175075 | + /* 1700 */ 111, 1088, 452, 263, 974, 1153, 266, 1092, 986, 987, |
| 175076 | + /* 1710 */ 942, 939, 125, 125, 565, 1103, 872, 1103, 159, 941, |
| 175077 | + /* 1720 */ 1309, 125, 1557, 1028, 1028, 1030, 1031, 35, 542, 337, |
| 175078 | + /* 1730 */ 1530, 205, 1529, 541, 499, 1589, 490, 348, 1376, 352, |
| 175079 | + /* 1740 */ 355, 1032, 357, 1040, 359, 1324, 1308, 366, 563, 121, |
| 175080 | + /* 1750 */ 121, 376, 1188, 1389, 1434, 1362, 280, 122, 1374, 452, |
| 175081 | + /* 1760 */ 577, 452, 167, 1439, 1028, 1289, 1280, 1268, 1267, 1269, |
| 175082 | + /* 1770 */ 1609, 1359, 312, 313, 314, 397, 12, 237, 224, 1421, |
| 175083 | + /* 1780 */ 295, 1416, 1409, 1426, 339, 484, 340, 509, 1371, 1612, |
| 175084 | + /* 1790 */ 1372, 1425, 1244, 404, 301, 228, 1028, 1028, 1030, 1031, |
| 175085 | + /* 1800 */ 35, 1601, 1192, 454, 345, 1307, 292, 369, 1502, 1501, |
| 175086 | + /* 1810 */ 270, 396, 396, 395, 277, 393, 1370, 1369, 859, 1549, |
| 175087 | + /* 1820 */ 186, 123, 568, 235, 4, 1188, 391, 210, 211, 223, |
| 175088 | + /* 1830 */ 1547, 239, 1241, 327, 422, 96, 220, 195, 571, 180, |
| 175089 | + /* 1840 */ 188, 326, 468, 469, 190, 191, 502, 192, 193, 566, |
| 175090 | + /* 1850 */ 247, 109, 1430, 491, 199, 251, 102, 281, 402, 476, |
| 175091 | + /* 1860 */ 405, 1496, 452, 497, 253, 1422, 13, 1428, 14, 1427, |
| 175092 | + /* 1870 */ 203, 1507, 241, 500, 565, 354, 407, 92, 95, 1270, |
| 175093 | + /* 1880 */ 175, 254, 518, 43, 1327, 255, 1326, 1325, 436, 1518, |
| 175094 | + /* 1890 */ 350, 1318, 104, 229, 893, 1626, 440, 441, 1625, 408, |
| 175095 | + /* 1900 */ 240, 1296, 268, 1040, 310, 269, 1297, 527, 444, 121, |
| 175096 | + /* 1910 */ 121, 368, 1295, 1594, 1624, 311, 1394, 122, 1317, 452, |
| 175097 | + /* 1920 */ 577, 452, 374, 1580, 1028, 1393, 140, 553, 11, 90, |
| 175098 | + /* 1930 */ 568, 385, 4, 116, 318, 414, 1579, 110, 1483, 537, |
| 175099 | + /* 1940 */ 320, 567, 1350, 555, 42, 579, 571, 1349, 1198, 383, |
| 175100 | + /* 1950 */ 276, 390, 216, 389, 278, 279, 1028, 1028, 1030, 1031, |
| 175101 | + /* 1960 */ 35, 172, 580, 1265, 458, 1260, 415, 416, 185, 156, |
| 175102 | + /* 1970 */ 452, 1534, 1535, 173, 1533, 1532, 89, 308, 225, 226, |
| 175103 | + /* 1980 */ 846, 174, 565, 453, 217, 1188, 322, 236, 1102, 154, |
| 175104 | + /* 1990 */ 1100, 330, 187, 176, 1223, 243, 189, 925, 338, 246, |
| 175105 | + /* 2000 */ 1116, 194, 177, 425, 178, 427, 98, 196, 99, 100, |
| 175106 | + /* 2010 */ 101, 1040, 179, 1119, 1115, 248, 249, 121, 121, 163, |
| 175107 | + /* 2020 */ 24, 250, 349, 1238, 496, 122, 1108, 452, 577, 452, |
| 175108 | + /* 2030 */ 1192, 454, 1028, 266, 292, 200, 252, 201, 861, 396, |
| 174725 | 175109 | /* 2040 */ 396, 395, 277, 393, 15, 501, 859, 370, 292, 256, |
| 174726 | 175110 | /* 2050 */ 202, 554, 505, 396, 396, 395, 277, 393, 103, 239, |
| 174727 | 175111 | /* 2060 */ 859, 327, 25, 26, 1028, 1028, 1030, 1031, 35, 326, |
| 174728 | 175112 | /* 2070 */ 362, 510, 891, 239, 365, 327, 513, 904, 105, 309, |
| 174729 | 175113 | /* 2080 */ 164, 181, 27, 326, 106, 521, 107, 1185, 1069, 1155, |
| 174730 | | - /* 2090 */ 17, 1154, 284, 1188, 286, 978, 265, 204, 125, 1171, |
| 174731 | | - /* 2100 */ 241, 230, 972, 1175, 28, 1160, 29, 1179, 175, 1173, |
| 174732 | | - /* 2110 */ 30, 43, 31, 1178, 241, 32, 41, 549, 8, 33, |
| 174733 | | - /* 2120 */ 208, 111, 175, 1083, 1070, 43, 113, 1068, 240, 114, |
| 174734 | | - /* 2130 */ 1072, 34, 1073, 561, 1124, 118, 271, 36, 18, 1194, |
| 174735 | | - /* 2140 */ 1033, 873, 240, 935, 124, 37, 272, 273, 1617, 572, |
| 174736 | | - /* 2150 */ 183, 153, 394, 1193, 1256, 1256, 1256, 1256, 1256, 1256, |
| 175114 | + /* 2090 */ 17, 1154, 230, 1188, 284, 286, 265, 204, 125, 1171, |
| 175115 | + /* 2100 */ 241, 28, 978, 972, 29, 41, 1175, 1179, 175, 1173, |
| 175116 | + /* 2110 */ 30, 43, 31, 8, 241, 1178, 32, 1160, 208, 549, |
| 175117 | + /* 2120 */ 33, 111, 175, 1083, 1070, 43, 1068, 1072, 240, 113, |
| 175118 | + /* 2130 */ 114, 34, 561, 118, 1124, 271, 1073, 36, 18, 572, |
| 175119 | + /* 2140 */ 1033, 873, 240, 124, 37, 935, 272, 273, 1617, 183, |
| 175120 | + /* 2150 */ 153, 394, 1194, 1193, 1256, 1256, 1256, 1256, 1256, 1256, |
| 174737 | 175121 | /* 2160 */ 1256, 1256, 1256, 414, 1256, 1256, 1256, 1256, 320, 567, |
| 174738 | 175122 | /* 2170 */ 1256, 1256, 1256, 1256, 1256, 1256, 1256, 414, 1256, 1256, |
| 174739 | 175123 | /* 2180 */ 1256, 1256, 320, 567, 1256, 1256, 1256, 1256, 1256, 1256, |
| 174740 | 175124 | /* 2190 */ 1256, 1256, 458, 1256, 1256, 1256, 1256, 1256, 1256, 1256, |
| 174741 | 175125 | /* 2200 */ 1256, 1256, 1256, 1256, 1256, 1256, 458, |
| 174742 | 175126 | }; |
| 174743 | 175127 | static const YYCODETYPE yy_lookahead[] = { |
| 174744 | | - /* 0 */ 276, 277, 278, 240, 241, 224, 194, 226, 194, 240, |
| 174745 | | - /* 10 */ 241, 194, 216, 220, 194, 234, 253, 194, 255, 19, |
| 174746 | | - /* 20 */ 224, 297, 253, 194, 255, 205, 212, 213, 205, 217, |
| 174747 | | - /* 30 */ 218, 31, 205, 194, 217, 218, 194, 217, 218, 39, |
| 174748 | | - /* 40 */ 217, 218, 312, 43, 44, 45, 316, 47, 48, 49, |
| 175128 | + /* 0 */ 277, 278, 279, 241, 242, 225, 195, 227, 195, 241, |
| 175129 | + /* 10 */ 242, 195, 217, 221, 195, 235, 254, 195, 256, 19, |
| 175130 | + /* 20 */ 225, 298, 254, 195, 256, 206, 213, 214, 206, 218, |
| 175131 | + /* 30 */ 219, 31, 206, 195, 218, 219, 195, 218, 219, 39, |
| 175132 | + /* 40 */ 218, 219, 313, 43, 44, 45, 317, 47, 48, 49, |
| 174749 | 175133 | /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 19, |
| 174750 | | - /* 60 */ 240, 241, 194, 240, 241, 194, 254, 240, 241, 276, |
| 174751 | | - /* 70 */ 277, 278, 233, 253, 254, 255, 253, 254, 255, 217, |
| 174752 | | - /* 80 */ 253, 239, 255, 43, 44, 45, 263, 47, 48, 49, |
| 174753 | | - /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 270, |
| 174754 | | - /* 100 */ 286, 22, 23, 103, 104, 105, 106, 107, 108, 109, |
| 174755 | | - /* 110 */ 110, 111, 112, 113, 114, 82, 47, 48, 49, 50, |
| 174756 | | - /* 120 */ 186, 187, 188, 189, 190, 191, 189, 87, 191, 89, |
| 174757 | | - /* 130 */ 196, 19, 198, 196, 317, 198, 319, 25, 194, 205, |
| 174758 | | - /* 140 */ 298, 270, 205, 103, 104, 105, 106, 107, 108, 109, |
| 174759 | | - /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 11, 47, |
| 175134 | + /* 60 */ 241, 242, 195, 241, 242, 195, 255, 241, 242, 277, |
| 175135 | + /* 70 */ 278, 279, 234, 254, 255, 256, 254, 255, 256, 218, |
| 175136 | + /* 80 */ 254, 240, 256, 43, 44, 45, 264, 47, 48, 49, |
| 175137 | + /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 271, |
| 175138 | + /* 100 */ 287, 22, 23, 103, 104, 105, 106, 107, 108, 109, |
| 175139 | + /* 110 */ 110, 111, 112, 113, 114, 114, 47, 48, 49, 50, |
| 175140 | + /* 120 */ 187, 188, 189, 190, 191, 192, 190, 87, 192, 89, |
| 175141 | + /* 130 */ 197, 19, 199, 197, 318, 199, 320, 25, 195, 206, |
| 175142 | + /* 140 */ 299, 271, 206, 103, 104, 105, 106, 107, 108, 109, |
| 175143 | + /* 150 */ 110, 111, 112, 113, 114, 43, 44, 45, 195, 47, |
| 174760 | 175144 | /* 160 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 174761 | | - /* 170 */ 58, 60, 139, 140, 240, 241, 214, 240, 241, 311, |
| 174762 | | - /* 180 */ 312, 102, 70, 239, 316, 194, 19, 253, 77, 255, |
| 174763 | | - /* 190 */ 253, 122, 255, 55, 56, 57, 58, 59, 207, 88, |
| 174764 | | - /* 200 */ 194, 90, 268, 194, 93, 268, 107, 108, 109, 110, |
| 174765 | | - /* 210 */ 111, 112, 113, 114, 47, 103, 104, 105, 106, 107, |
| 174766 | | - /* 220 */ 108, 109, 110, 111, 112, 113, 114, 114, 117, 118, |
| 174767 | | - /* 230 */ 119, 276, 277, 278, 300, 19, 194, 300, 276, 277, |
| 174768 | | - /* 240 */ 278, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 174769 | | - /* 250 */ 112, 113, 114, 55, 56, 57, 58, 146, 194, 43, |
| 174770 | | - /* 260 */ 44, 45, 47, 47, 48, 49, 50, 51, 52, 53, |
| 174771 | | - /* 270 */ 54, 55, 56, 57, 58, 82, 129, 130, 60, 129, |
| 174772 | | - /* 280 */ 130, 217, 218, 116, 68, 25, 103, 104, 105, 106, |
| 174773 | | - /* 290 */ 107, 108, 109, 110, 111, 112, 113, 114, 23, 132, |
| 174774 | | - /* 300 */ 294, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 174775 | | - /* 310 */ 112, 113, 114, 217, 121, 306, 194, 308, 26, 103, |
| 175145 | + /* 170 */ 58, 60, 21, 195, 241, 242, 215, 241, 242, 312, |
| 175146 | + /* 180 */ 313, 102, 70, 205, 317, 207, 242, 254, 77, 256, |
| 175147 | + /* 190 */ 254, 122, 256, 55, 56, 57, 58, 59, 254, 88, |
| 175148 | + /* 200 */ 256, 90, 269, 240, 93, 269, 107, 108, 109, 110, |
| 175149 | + /* 210 */ 111, 112, 113, 114, 271, 103, 104, 105, 106, 107, |
| 175150 | + /* 220 */ 108, 109, 110, 111, 112, 113, 114, 313, 117, 118, |
| 175151 | + /* 230 */ 119, 317, 81, 195, 301, 19, 195, 301, 277, 278, |
| 175152 | + /* 240 */ 279, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 175153 | + /* 250 */ 112, 113, 114, 55, 56, 57, 58, 146, 195, 43, |
| 175154 | + /* 260 */ 44, 45, 74, 47, 48, 49, 50, 51, 52, 53, |
| 175155 | + /* 270 */ 54, 55, 56, 57, 58, 124, 195, 60, 109, 110, |
| 175156 | + /* 280 */ 111, 112, 113, 114, 68, 195, 103, 104, 105, 106, |
| 175157 | + /* 290 */ 107, 108, 109, 110, 111, 112, 113, 114, 208, 218, |
| 175158 | + /* 300 */ 219, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 175159 | + /* 310 */ 112, 113, 114, 162, 233, 24, 128, 129, 130, 103, |
| 174776 | 175160 | /* 320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
| 174777 | | - /* 330 */ 114, 116, 139, 140, 217, 117, 118, 119, 120, 19, |
| 174778 | | - /* 340 */ 194, 123, 124, 125, 24, 109, 110, 111, 112, 113, |
| 174779 | | - /* 350 */ 114, 133, 60, 311, 312, 250, 194, 252, 316, 19, |
| 174780 | | - /* 360 */ 194, 166, 167, 43, 44, 45, 205, 47, 48, 49, |
| 174781 | | - /* 370 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 217, |
| 174782 | | - /* 380 */ 218, 317, 318, 43, 44, 45, 264, 47, 48, 49, |
| 174783 | | - /* 390 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 139, |
| 174784 | | - /* 400 */ 140, 240, 241, 139, 140, 188, 189, 190, 191, 117, |
| 174785 | | - /* 410 */ 118, 119, 231, 196, 253, 198, 255, 194, 194, 258, |
| 174786 | | - /* 420 */ 259, 146, 205, 103, 104, 105, 106, 107, 108, 109, |
| 174787 | | - /* 430 */ 110, 111, 112, 113, 114, 109, 212, 213, 236, 237, |
| 174788 | | - /* 440 */ 217, 218, 194, 103, 104, 105, 106, 107, 108, 109, |
| 174789 | | - /* 450 */ 110, 111, 112, 113, 114, 194, 120, 240, 241, 123, |
| 174790 | | - /* 460 */ 124, 125, 136, 194, 19, 74, 60, 141, 23, 133, |
| 174791 | | - /* 470 */ 253, 194, 255, 82, 194, 309, 310, 254, 29, 317, |
| 174792 | | - /* 480 */ 318, 194, 33, 22, 199, 268, 263, 239, 43, 44, |
| 175161 | + /* 330 */ 114, 195, 195, 215, 117, 118, 119, 120, 195, 19, |
| 175162 | + /* 340 */ 123, 124, 125, 207, 24, 74, 246, 60, 310, 311, |
| 175163 | + /* 350 */ 133, 60, 311, 82, 22, 218, 219, 257, 195, 19, |
| 175164 | + /* 360 */ 73, 218, 219, 43, 44, 45, 206, 47, 48, 49, |
| 175165 | + /* 370 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 22, |
| 175166 | + /* 380 */ 23, 218, 219, 43, 44, 45, 54, 47, 48, 49, |
| 175167 | + /* 390 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 128, |
| 175168 | + /* 400 */ 82, 241, 242, 195, 117, 118, 119, 289, 60, 118, |
| 175169 | + /* 410 */ 139, 140, 294, 195, 254, 195, 256, 195, 255, 259, |
| 175170 | + /* 420 */ 260, 73, 22, 103, 104, 105, 106, 107, 108, 109, |
| 175171 | + /* 430 */ 110, 111, 112, 113, 114, 206, 218, 219, 218, 219, |
| 175172 | + /* 440 */ 218, 219, 234, 103, 104, 105, 106, 107, 108, 109, |
| 175173 | + /* 450 */ 110, 111, 112, 113, 114, 318, 319, 139, 140, 102, |
| 175174 | + /* 460 */ 60, 318, 319, 221, 19, 117, 118, 119, 23, 195, |
| 175175 | + /* 470 */ 241, 242, 313, 255, 206, 255, 317, 255, 206, 129, |
| 175176 | + /* 480 */ 130, 206, 264, 254, 264, 256, 264, 195, 43, 44, |
| 174793 | 175177 | /* 490 */ 45, 151, 47, 48, 49, 50, 51, 52, 53, 54, |
| 174794 | | - /* 500 */ 55, 56, 57, 58, 217, 218, 194, 60, 19, 146, |
| 174795 | | - /* 510 */ 286, 242, 23, 107, 108, 66, 204, 300, 206, 128, |
| 174796 | | - /* 520 */ 73, 60, 116, 117, 118, 119, 265, 121, 165, 60, |
| 174797 | | - /* 530 */ 139, 140, 43, 44, 45, 129, 47, 48, 49, 50, |
| 175178 | + /* 500 */ 55, 56, 57, 58, 246, 213, 214, 19, 19, 241, |
| 175179 | + /* 510 */ 242, 195, 23, 241, 242, 257, 241, 242, 118, 277, |
| 175180 | + /* 520 */ 278, 279, 254, 29, 256, 60, 254, 33, 256, 254, |
| 175181 | + /* 530 */ 206, 256, 43, 44, 45, 218, 47, 48, 49, 50, |
| 174798 | 175182 | /* 540 */ 51, 52, 53, 54, 55, 56, 57, 58, 103, 104, |
| 174799 | 175183 | /* 550 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 174800 | | - /* 560 */ 154, 194, 156, 194, 117, 118, 119, 280, 283, 205, |
| 174801 | | - /* 570 */ 101, 220, 287, 19, 20, 306, 22, 308, 117, 118, |
| 174802 | | - /* 580 */ 119, 211, 212, 213, 217, 218, 117, 118, 236, 237, |
| 174803 | | - /* 590 */ 36, 122, 103, 104, 105, 106, 107, 108, 109, 110, |
| 174804 | | - /* 600 */ 111, 112, 113, 114, 240, 241, 194, 60, 194, 194, |
| 174805 | | - /* 610 */ 194, 194, 19, 194, 60, 194, 23, 253, 206, 255, |
| 174806 | | - /* 620 */ 73, 254, 19, 154, 155, 156, 72, 276, 277, 278, |
| 174807 | | - /* 630 */ 263, 217, 218, 217, 218, 271, 43, 44, 45, 271, |
| 175184 | + /* 560 */ 66, 19, 218, 60, 120, 241, 242, 123, 124, 125, |
| 175185 | + /* 570 */ 60, 232, 77, 19, 20, 26, 22, 133, 254, 287, |
| 175186 | + /* 580 */ 256, 265, 117, 118, 119, 90, 312, 313, 93, 47, |
| 175187 | + /* 590 */ 36, 317, 103, 104, 105, 106, 107, 108, 109, 110, |
| 175188 | + /* 600 */ 111, 112, 113, 114, 116, 117, 277, 278, 279, 60, |
| 175189 | + /* 610 */ 107, 108, 19, 276, 60, 31, 23, 152, 195, 116, |
| 175190 | + /* 620 */ 117, 118, 119, 39, 121, 276, 72, 117, 118, 119, |
| 175191 | + /* 630 */ 166, 167, 129, 145, 237, 238, 43, 44, 45, 276, |
| 174808 | 175192 | /* 640 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 174809 | | - /* 650 */ 57, 58, 183, 194, 285, 101, 19, 214, 60, 242, |
| 174810 | | - /* 660 */ 23, 107, 108, 109, 117, 118, 119, 16, 254, 115, |
| 174811 | | - /* 670 */ 254, 117, 118, 119, 194, 60, 122, 263, 205, 264, |
| 174812 | | - /* 680 */ 43, 44, 45, 264, 47, 48, 49, 50, 51, 52, |
| 175193 | + /* 650 */ 57, 58, 315, 316, 144, 101, 19, 154, 116, 156, |
| 175194 | + /* 660 */ 23, 107, 108, 109, 315, 316, 117, 118, 119, 115, |
| 175195 | + /* 670 */ 60, 117, 118, 119, 132, 200, 122, 60, 315, 316, |
| 175196 | + /* 680 */ 43, 44, 45, 272, 47, 48, 49, 50, 51, 52, |
| 174813 | 175197 | /* 690 */ 53, 54, 55, 56, 57, 58, 103, 104, 105, 106, |
| 174814 | 175198 | /* 700 */ 107, 108, 109, 110, 111, 112, 113, 114, 154, 155, |
| 174815 | | - /* 710 */ 156, 157, 158, 240, 241, 117, 118, 119, 101, 205, |
| 174816 | | - /* 720 */ 117, 19, 20, 306, 22, 308, 253, 74, 255, 78, |
| 174817 | | - /* 730 */ 205, 80, 117, 118, 119, 118, 293, 183, 36, 122, |
| 175199 | + /* 710 */ 156, 157, 158, 212, 213, 214, 22, 195, 101, 22, |
| 175200 | + /* 720 */ 60, 19, 20, 60, 22, 139, 140, 117, 118, 119, |
| 175201 | + /* 730 */ 22, 251, 195, 253, 117, 118, 195, 183, 36, 122, |
| 174818 | 175202 | /* 740 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 174819 | | - /* 750 */ 113, 114, 194, 294, 240, 241, 211, 212, 213, 144, |
| 174820 | | - /* 760 */ 19, 23, 60, 25, 23, 240, 241, 253, 245, 255, |
| 174821 | | - /* 770 */ 15, 154, 155, 156, 72, 217, 218, 194, 253, 256, |
| 174822 | | - /* 780 */ 255, 128, 129, 130, 43, 44, 45, 22, 47, 48, |
| 175203 | + /* 750 */ 113, 114, 195, 195, 60, 218, 219, 60, 195, 284, |
| 175204 | + /* 760 */ 19, 25, 60, 288, 23, 237, 238, 22, 60, 109, |
| 175205 | + /* 770 */ 233, 154, 155, 156, 72, 218, 219, 117, 118, 119, |
| 175206 | + /* 780 */ 117, 118, 119, 116, 43, 44, 45, 265, 47, 48, |
| 174823 | 175207 | /* 790 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, |
| 174824 | | - /* 800 */ 183, 19, 77, 101, 19, 128, 129, 130, 23, 107, |
| 174825 | | - /* 810 */ 108, 60, 254, 88, 21, 90, 61, 115, 93, 117, |
| 174826 | | - /* 820 */ 118, 119, 239, 22, 122, 60, 194, 205, 43, 44, |
| 174827 | | - /* 830 */ 45, 205, 47, 48, 49, 50, 51, 52, 53, 54, |
| 175208 | + /* 800 */ 183, 243, 25, 101, 19, 60, 265, 144, 23, 107, |
| 175209 | + /* 810 */ 108, 117, 118, 119, 117, 118, 119, 115, 151, 117, |
| 175210 | + /* 820 */ 118, 119, 82, 195, 122, 117, 118, 119, 43, 44, |
| 175211 | + /* 830 */ 45, 195, 47, 48, 49, 50, 51, 52, 53, 54, |
| 174828 | 175212 | /* 840 */ 55, 56, 57, 58, 103, 104, 105, 106, 107, 108, |
| 174829 | 175213 | /* 850 */ 109, 110, 111, 112, 113, 114, 154, 155, 156, 157, |
| 174830 | | - /* 860 */ 158, 60, 240, 241, 60, 116, 240, 241, 117, 118, |
| 174831 | | - /* 870 */ 119, 146, 194, 19, 81, 253, 275, 255, 24, 253, |
| 174832 | | - /* 880 */ 98, 255, 117, 118, 119, 183, 22, 194, 103, 104, |
| 175214 | + /* 860 */ 158, 121, 117, 118, 119, 307, 101, 309, 195, 22, |
| 175215 | + /* 870 */ 23, 195, 25, 19, 35, 139, 140, 195, 24, 139, |
| 175216 | + /* 880 */ 140, 208, 195, 118, 109, 183, 22, 122, 103, 104, |
| 174833 | 175217 | /* 890 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 174834 | | - /* 900 */ 151, 194, 270, 152, 22, 23, 194, 25, 19, 202, |
| 174835 | | - /* 910 */ 217, 218, 23, 109, 207, 314, 315, 124, 117, 118, |
| 174836 | | - /* 920 */ 119, 117, 118, 119, 60, 232, 22, 23, 19, 25, |
| 174837 | | - /* 930 */ 303, 304, 43, 44, 45, 22, 47, 48, 49, 50, |
| 174838 | | - /* 940 */ 51, 52, 53, 54, 55, 56, 57, 58, 270, 227, |
| 174839 | | - /* 950 */ 96, 60, 43, 44, 45, 162, 47, 48, 49, 50, |
| 174840 | | - /* 960 */ 51, 52, 53, 54, 55, 56, 57, 58, 114, 112, |
| 174841 | | - /* 970 */ 113, 114, 194, 60, 120, 121, 122, 123, 124, 125, |
| 174842 | | - /* 980 */ 126, 117, 118, 119, 102, 25, 132, 107, 108, 194, |
| 174843 | | - /* 990 */ 194, 227, 103, 104, 105, 106, 107, 108, 109, 110, |
| 174844 | | - /* 1000 */ 111, 112, 113, 114, 194, 194, 102, 194, 117, 118, |
| 174845 | | - /* 1010 */ 119, 233, 103, 104, 105, 106, 107, 108, 109, 110, |
| 174846 | | - /* 1020 */ 111, 112, 113, 114, 194, 194, 19, 194, 217, 218, |
| 174847 | | - /* 1030 */ 117, 118, 119, 241, 154, 144, 156, 135, 242, 137, |
| 174848 | | - /* 1040 */ 138, 130, 19, 232, 194, 253, 23, 255, 217, 218, |
| 174849 | | - /* 1050 */ 217, 218, 242, 16, 7, 8, 9, 25, 261, 262, |
| 174850 | | - /* 1060 */ 265, 194, 19, 232, 153, 232, 43, 44, 45, 160, |
| 175218 | + /* 900 */ 304, 305, 77, 230, 127, 232, 67, 195, 19, 195, |
| 175219 | + /* 910 */ 195, 136, 23, 88, 75, 90, 141, 203, 93, 154, |
| 175220 | + /* 920 */ 155, 156, 208, 295, 60, 243, 22, 23, 19, 25, |
| 175221 | + /* 930 */ 218, 219, 43, 44, 45, 100, 47, 48, 49, 50, |
| 175222 | + /* 940 */ 51, 52, 53, 54, 55, 56, 57, 58, 183, 102, |
| 175223 | + /* 950 */ 96, 195, 43, 44, 45, 240, 47, 48, 49, 50, |
| 175224 | + /* 960 */ 51, 52, 53, 54, 55, 56, 57, 58, 114, 134, |
| 175225 | + /* 970 */ 131, 146, 25, 286, 120, 121, 122, 123, 124, 125, |
| 175226 | + /* 980 */ 126, 117, 118, 119, 313, 195, 132, 195, 317, 307, |
| 175227 | + /* 990 */ 195, 309, 103, 104, 105, 106, 107, 108, 109, 110, |
| 175228 | + /* 1000 */ 111, 112, 113, 114, 195, 195, 102, 195, 195, 195, |
| 175229 | + /* 1010 */ 218, 219, 103, 104, 105, 106, 107, 108, 109, 110, |
| 175230 | + /* 1020 */ 111, 112, 113, 114, 77, 233, 195, 60, 218, 219, |
| 175231 | + /* 1030 */ 218, 219, 218, 219, 23, 195, 25, 90, 243, 159, |
| 175232 | + /* 1040 */ 93, 161, 19, 233, 195, 233, 23, 233, 16, 218, |
| 175233 | + /* 1050 */ 219, 195, 243, 212, 213, 214, 262, 263, 218, 219, |
| 175234 | + /* 1060 */ 195, 271, 19, 307, 233, 309, 43, 44, 45, 160, |
| 174851 | 175235 | /* 1070 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 174852 | | - /* 1080 */ 57, 58, 194, 227, 217, 218, 43, 44, 45, 194, |
| 175236 | + /* 1080 */ 57, 58, 195, 218, 219, 118, 43, 44, 45, 240, |
| 174853 | 175237 | /* 1090 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 174854 | | - /* 1100 */ 57, 58, 306, 143, 308, 217, 218, 294, 12, 77, |
| 174855 | | - /* 1110 */ 22, 23, 217, 218, 194, 78, 306, 80, 308, 194, |
| 174856 | | - /* 1120 */ 232, 254, 90, 27, 117, 93, 103, 104, 105, 106, |
| 174857 | | - /* 1130 */ 107, 108, 109, 110, 111, 112, 113, 114, 42, 194, |
| 174858 | | - /* 1140 */ 35, 194, 217, 218, 214, 194, 103, 104, 105, 106, |
| 174859 | | - /* 1150 */ 107, 108, 109, 110, 111, 112, 113, 114, 194, 239, |
| 174860 | | - /* 1160 */ 64, 194, 217, 218, 217, 218, 209, 210, 217, 218, |
| 174861 | | - /* 1170 */ 74, 207, 67, 22, 194, 77, 19, 232, 245, 232, |
| 174862 | | - /* 1180 */ 75, 24, 312, 232, 217, 218, 316, 25, 90, 256, |
| 174863 | | - /* 1190 */ 102, 93, 159, 229, 161, 231, 19, 217, 218, 162, |
| 175238 | + /* 1100 */ 57, 58, 307, 195, 309, 218, 219, 263, 12, 195, |
| 175239 | + /* 1110 */ 78, 267, 80, 112, 113, 114, 307, 22, 309, 24, |
| 175240 | + /* 1120 */ 255, 281, 266, 27, 107, 108, 103, 104, 105, 106, |
| 175241 | + /* 1130 */ 107, 108, 109, 110, 111, 112, 113, 114, 42, 195, |
| 175242 | + /* 1140 */ 11, 22, 255, 24, 195, 195, 103, 104, 105, 106, |
| 175243 | + /* 1150 */ 107, 108, 109, 110, 111, 112, 113, 114, 19, 195, |
| 175244 | + /* 1160 */ 64, 195, 218, 219, 195, 313, 195, 218, 219, 317, |
| 175245 | + /* 1170 */ 74, 154, 195, 156, 195, 195, 19, 233, 23, 60, |
| 175246 | + /* 1180 */ 25, 24, 218, 219, 218, 219, 195, 218, 219, 218, |
| 175247 | + /* 1190 */ 219, 128, 129, 130, 162, 263, 19, 218, 219, 267, |
| 174864 | 175248 | /* 1200 */ 43, 44, 45, 160, 47, 48, 49, 50, 51, 52, |
| 174865 | | - /* 1210 */ 53, 54, 55, 56, 57, 58, 19, 23, 288, 25, |
| 174866 | | - /* 1220 */ 43, 44, 45, 293, 47, 48, 49, 50, 51, 52, |
| 174867 | | - /* 1230 */ 53, 54, 55, 56, 57, 58, 131, 22, 275, 24, |
| 174868 | | - /* 1240 */ 43, 44, 45, 194, 47, 48, 49, 50, 51, 52, |
| 174869 | | - /* 1250 */ 53, 54, 55, 56, 57, 58, 194, 194, 107, 108, |
| 175249 | + /* 1210 */ 53, 54, 55, 56, 57, 58, 19, 240, 228, 255, |
| 175250 | + /* 1220 */ 43, 44, 45, 25, 47, 48, 49, 50, 51, 52, |
| 175251 | + /* 1230 */ 53, 54, 55, 56, 57, 58, 135, 118, 137, 138, |
| 175252 | + /* 1240 */ 43, 44, 45, 22, 47, 48, 49, 50, 51, 52, |
| 175253 | + /* 1250 */ 53, 54, 55, 56, 57, 58, 117, 266, 129, 130, |
| 174870 | 175254 | /* 1260 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 174871 | | - /* 1270 */ 113, 114, 194, 25, 194, 60, 194, 314, 315, 194, |
| 175255 | + /* 1270 */ 113, 114, 195, 195, 119, 295, 195, 206, 195, 195, |
| 174872 | 175256 | /* 1280 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 174873 | | - /* 1290 */ 113, 114, 19, 194, 194, 217, 218, 217, 218, 25, |
| 175257 | + /* 1290 */ 113, 114, 195, 195, 195, 218, 219, 195, 195, 144, |
| 174874 | 175258 | /* 1300 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 174875 | | - /* 1310 */ 113, 114, 150, 119, 265, 312, 67, 217, 218, 316, |
| 174876 | | - /* 1320 */ 19, 239, 194, 194, 128, 129, 130, 265, 265, 209, |
| 174877 | | - /* 1330 */ 210, 31, 254, 118, 254, 86, 60, 194, 144, 39, |
| 174878 | | - /* 1340 */ 19, 130, 275, 312, 95, 44, 45, 316, 47, 48, |
| 175259 | + /* 1310 */ 113, 114, 241, 242, 67, 218, 219, 218, 219, 146, |
| 175260 | + /* 1320 */ 19, 218, 219, 240, 215, 254, 136, 256, 107, 108, |
| 175261 | + /* 1330 */ 195, 141, 255, 86, 128, 129, 130, 195, 165, 195, |
| 175262 | + /* 1340 */ 19, 143, 95, 272, 25, 44, 45, 266, 47, 48, |
| 174879 | 175263 | /* 1350 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, |
| 174880 | | - /* 1360 */ 217, 218, 24, 194, 153, 12, 45, 119, 47, 48, |
| 175264 | + /* 1360 */ 218, 219, 218, 219, 195, 12, 45, 195, 47, 48, |
| 174881 | 175265 | /* 1370 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, |
| 174882 | | - /* 1380 */ 27, 314, 315, 22, 312, 24, 217, 218, 316, 116, |
| 174883 | | - /* 1390 */ 117, 22, 144, 25, 118, 42, 147, 194, 60, 19, |
| 174884 | | - /* 1400 */ 20, 127, 22, 194, 103, 104, 105, 106, 107, 108, |
| 174885 | | - /* 1410 */ 109, 110, 111, 112, 113, 114, 36, 64, 145, 194, |
| 174886 | | - /* 1420 */ 217, 218, 194, 54, 103, 104, 105, 106, 107, 108, |
| 174887 | | - /* 1430 */ 109, 110, 111, 112, 113, 114, 194, 22, 310, 25, |
| 174888 | | - /* 1440 */ 60, 194, 217, 218, 194, 217, 218, 194, 260, 194, |
| 174889 | | - /* 1450 */ 301, 302, 72, 262, 262, 194, 118, 266, 266, 217, |
| 174890 | | - /* 1460 */ 218, 194, 82, 245, 217, 218, 194, 217, 218, 194, |
| 174891 | | - /* 1470 */ 217, 218, 217, 218, 256, 60, 24, 194, 217, 218, |
| 174892 | | - /* 1480 */ 194, 101, 194, 245, 217, 218, 194, 107, 108, 217, |
| 174893 | | - /* 1490 */ 218, 22, 217, 218, 256, 115, 245, 117, 118, 119, |
| 174894 | | - /* 1500 */ 217, 218, 122, 217, 218, 217, 218, 256, 22, 217, |
| 174895 | | - /* 1510 */ 218, 116, 258, 259, 146, 19, 20, 194, 22, 139, |
| 174896 | | - /* 1520 */ 140, 150, 151, 136, 23, 194, 25, 194, 141, 194, |
| 174897 | | - /* 1530 */ 194, 62, 36, 118, 154, 155, 156, 157, 158, 100, |
| 174898 | | - /* 1540 */ 145, 194, 154, 194, 156, 49, 194, 23, 194, 25, |
| 174899 | | - /* 1550 */ 217, 218, 217, 218, 194, 257, 60, 143, 194, 60, |
| 174900 | | - /* 1560 */ 194, 121, 122, 183, 217, 218, 217, 218, 72, 217, |
| 174901 | | - /* 1570 */ 218, 217, 218, 134, 23, 194, 25, 217, 218, 7, |
| 174902 | | - /* 1580 */ 8, 321, 86, 217, 218, 194, 122, 91, 19, 20, |
| 174903 | | - /* 1590 */ 23, 22, 25, 23, 142, 25, 132, 101, 217, 218, |
| 174904 | | - /* 1600 */ 194, 194, 194, 107, 108, 36, 194, 194, 217, 218, |
| 174905 | | - /* 1610 */ 194, 115, 194, 117, 118, 119, 194, 118, 122, 194, |
| 174906 | | - /* 1620 */ 23, 194, 25, 217, 218, 217, 218, 194, 142, 60, |
| 174907 | | - /* 1630 */ 217, 218, 194, 217, 218, 217, 218, 84, 85, 217, |
| 174908 | | - /* 1640 */ 218, 72, 217, 218, 217, 218, 60, 23, 60, 25, |
| 174909 | | - /* 1650 */ 154, 155, 156, 157, 158, 86, 154, 194, 156, 194, |
| 174910 | | - /* 1660 */ 91, 19, 20, 23, 22, 25, 194, 23, 194, 25, |
| 174911 | | - /* 1670 */ 101, 23, 194, 25, 194, 194, 107, 108, 36, 183, |
| 174912 | | - /* 1680 */ 217, 218, 217, 218, 115, 194, 117, 118, 119, 217, |
| 174913 | | - /* 1690 */ 218, 122, 194, 237, 194, 217, 218, 217, 218, 194, |
| 174914 | | - /* 1700 */ 194, 23, 60, 25, 118, 23, 118, 25, 217, 218, |
| 174915 | | - /* 1710 */ 23, 194, 25, 194, 72, 217, 218, 217, 218, 23, |
| 174916 | | - /* 1720 */ 194, 25, 194, 154, 155, 156, 157, 158, 86, 23, |
| 174917 | | - /* 1730 */ 194, 25, 194, 91, 217, 218, 217, 218, 194, 194, |
| 174918 | | - /* 1740 */ 194, 194, 194, 101, 194, 217, 218, 290, 194, 107, |
| 174919 | | - /* 1750 */ 108, 194, 183, 217, 218, 194, 194, 115, 194, 117, |
| 174920 | | - /* 1760 */ 118, 119, 194, 243, 122, 194, 289, 194, 194, 194, |
| 174921 | | - /* 1770 */ 194, 257, 257, 257, 244, 257, 192, 273, 215, 269, |
| 174922 | | - /* 1780 */ 246, 299, 269, 295, 247, 273, 247, 246, 295, 230, |
| 174923 | | - /* 1790 */ 261, 226, 261, 261, 273, 273, 154, 155, 156, 157, |
| 174924 | | - /* 1800 */ 158, 0, 1, 2, 221, 220, 5, 220, 250, 220, |
| 174925 | | - /* 1810 */ 261, 10, 11, 12, 13, 14, 250, 282, 17, 197, |
| 174926 | | - /* 1820 */ 61, 19, 20, 246, 22, 183, 244, 142, 201, 201, |
| 174927 | | - /* 1830 */ 38, 30, 299, 32, 201, 152, 22, 151, 36, 299, |
| 174928 | | - /* 1840 */ 43, 40, 235, 18, 238, 285, 238, 238, 296, 238, |
| 174929 | | - /* 1850 */ 201, 296, 274, 272, 18, 200, 235, 150, 235, 247, |
| 174930 | | - /* 1860 */ 247, 247, 60, 247, 274, 274, 272, 201, 200, 159, |
| 174931 | | - /* 1870 */ 63, 292, 71, 201, 72, 200, 22, 201, 222, 200, |
| 174932 | | - /* 1880 */ 79, 201, 222, 82, 291, 116, 219, 65, 200, 219, |
| 174933 | | - /* 1890 */ 219, 228, 22, 127, 225, 166, 222, 24, 225, 114, |
| 174934 | | - /* 1900 */ 99, 284, 221, 101, 284, 228, 307, 315, 219, 107, |
| 174935 | | - /* 1910 */ 108, 219, 219, 219, 201, 92, 320, 115, 320, 117, |
| 174936 | | - /* 1920 */ 118, 119, 222, 83, 122, 267, 267, 149, 146, 19, |
| 174937 | | - /* 1930 */ 20, 22, 22, 279, 250, 134, 201, 148, 159, 249, |
| 174938 | | - /* 1940 */ 139, 140, 251, 141, 25, 281, 36, 147, 251, 248, |
| 174939 | | - /* 1950 */ 247, 203, 13, 195, 6, 195, 154, 155, 156, 157, |
| 174940 | | - /* 1960 */ 158, 193, 305, 193, 163, 193, 305, 302, 214, 208, |
| 174941 | | - /* 1970 */ 60, 214, 208, 223, 223, 4, 214, 214, 3, 22, |
| 174942 | | - /* 1980 */ 215, 214, 72, 208, 164, 183, 215, 15, 23, 16, |
| 174943 | | - /* 1990 */ 23, 140, 131, 152, 25, 143, 20, 16, 24, 1, |
| 174944 | | - /* 2000 */ 145, 143, 131, 131, 62, 37, 54, 54, 152, 54, |
| 174945 | | - /* 2010 */ 54, 101, 131, 117, 34, 1, 142, 107, 108, 22, |
| 174946 | | - /* 2020 */ 5, 116, 162, 69, 25, 115, 76, 117, 118, 119, |
| 174947 | | - /* 2030 */ 1, 2, 122, 69, 5, 41, 142, 116, 20, 10, |
| 175266 | + /* 1380 */ 27, 23, 7, 8, 9, 210, 211, 218, 219, 116, |
| 175267 | + /* 1390 */ 218, 219, 228, 16, 147, 42, 195, 295, 195, 19, |
| 175268 | + /* 1400 */ 20, 266, 22, 294, 103, 104, 105, 106, 107, 108, |
| 175269 | + /* 1410 */ 109, 110, 111, 112, 113, 114, 36, 64, 145, 218, |
| 175270 | + /* 1420 */ 219, 218, 219, 195, 103, 104, 105, 106, 107, 108, |
| 175271 | + /* 1430 */ 109, 110, 111, 112, 113, 114, 195, 154, 119, 156, |
| 175272 | + /* 1440 */ 60, 189, 190, 191, 192, 195, 218, 219, 195, 197, |
| 175273 | + /* 1450 */ 195, 199, 72, 195, 19, 78, 195, 80, 206, 218, |
| 175274 | + /* 1460 */ 219, 195, 82, 144, 210, 211, 195, 15, 218, 219, |
| 175275 | + /* 1470 */ 47, 218, 219, 218, 219, 259, 260, 195, 261, 218, |
| 175276 | + /* 1480 */ 219, 101, 302, 303, 218, 219, 195, 107, 108, 218, |
| 175277 | + /* 1490 */ 219, 150, 151, 241, 242, 115, 25, 117, 118, 119, |
| 175278 | + /* 1500 */ 218, 219, 122, 195, 146, 195, 254, 195, 256, 218, |
| 175279 | + /* 1510 */ 219, 246, 25, 61, 246, 19, 20, 195, 22, 139, |
| 175280 | + /* 1520 */ 140, 269, 257, 195, 266, 257, 218, 219, 218, 219, |
| 175281 | + /* 1530 */ 218, 219, 36, 246, 154, 155, 156, 157, 158, 116, |
| 175282 | + /* 1540 */ 218, 219, 195, 22, 257, 49, 218, 219, 23, 195, |
| 175283 | + /* 1550 */ 25, 195, 117, 301, 195, 25, 60, 195, 195, 23, |
| 175284 | + /* 1560 */ 195, 25, 195, 183, 24, 218, 219, 130, 72, 195, |
| 175285 | + /* 1570 */ 22, 195, 218, 219, 218, 219, 195, 218, 219, 195, |
| 175286 | + /* 1580 */ 218, 219, 86, 218, 219, 218, 219, 91, 19, 20, |
| 175287 | + /* 1590 */ 153, 22, 218, 219, 218, 219, 195, 101, 195, 218, |
| 175288 | + /* 1600 */ 219, 195, 195, 107, 108, 36, 23, 195, 25, 195, |
| 175289 | + /* 1610 */ 62, 115, 195, 117, 118, 119, 195, 146, 122, 218, |
| 175290 | + /* 1620 */ 219, 218, 219, 195, 218, 219, 19, 60, 122, 60, |
| 175291 | + /* 1630 */ 218, 219, 218, 219, 195, 218, 219, 150, 132, 218, |
| 175292 | + /* 1640 */ 219, 72, 195, 23, 195, 25, 218, 219, 195, 60, |
| 175293 | + /* 1650 */ 154, 155, 156, 157, 158, 86, 23, 195, 25, 195, |
| 175294 | + /* 1660 */ 91, 19, 20, 142, 22, 218, 219, 218, 219, 130, |
| 175295 | + /* 1670 */ 101, 218, 219, 143, 121, 122, 107, 108, 36, 183, |
| 175296 | + /* 1680 */ 218, 219, 142, 60, 115, 118, 117, 118, 119, 7, |
| 175297 | + /* 1690 */ 8, 122, 153, 23, 23, 25, 25, 23, 23, 25, |
| 175298 | + /* 1700 */ 25, 23, 60, 25, 23, 98, 25, 118, 84, 85, |
| 175299 | + /* 1710 */ 23, 23, 25, 25, 72, 154, 23, 156, 25, 23, |
| 175300 | + /* 1720 */ 228, 25, 195, 154, 155, 156, 157, 158, 86, 195, |
| 175301 | + /* 1730 */ 195, 258, 195, 91, 291, 322, 195, 195, 195, 195, |
| 175302 | + /* 1740 */ 195, 118, 195, 101, 195, 195, 195, 195, 238, 107, |
| 175303 | + /* 1750 */ 108, 195, 183, 195, 195, 195, 290, 115, 195, 117, |
| 175304 | + /* 1760 */ 118, 119, 244, 195, 122, 195, 195, 195, 195, 195, |
| 175305 | + /* 1770 */ 195, 258, 258, 258, 258, 193, 245, 300, 216, 274, |
| 175306 | + /* 1780 */ 247, 270, 270, 274, 296, 296, 248, 222, 262, 198, |
| 175307 | + /* 1790 */ 262, 274, 61, 274, 248, 231, 154, 155, 156, 157, |
| 175308 | + /* 1800 */ 158, 0, 1, 2, 247, 227, 5, 221, 221, 221, |
| 175309 | + /* 1810 */ 142, 10, 11, 12, 13, 14, 262, 262, 17, 202, |
| 175310 | + /* 1820 */ 300, 19, 20, 300, 22, 183, 247, 251, 251, 245, |
| 175311 | + /* 1830 */ 202, 30, 38, 32, 202, 152, 151, 22, 36, 43, |
| 175312 | + /* 1840 */ 236, 40, 18, 202, 239, 239, 18, 239, 239, 283, |
| 175313 | + /* 1850 */ 201, 150, 236, 202, 236, 201, 159, 202, 248, 248, |
| 175314 | + /* 1860 */ 248, 248, 60, 63, 201, 275, 273, 275, 273, 275, |
| 175315 | + /* 1870 */ 22, 286, 71, 223, 72, 202, 223, 297, 297, 202, |
| 175316 | + /* 1880 */ 79, 201, 116, 82, 220, 201, 220, 220, 65, 293, |
| 175317 | + /* 1890 */ 292, 229, 22, 166, 127, 226, 24, 114, 226, 223, |
| 175318 | + /* 1900 */ 99, 222, 202, 101, 285, 92, 220, 308, 83, 107, |
| 175319 | + /* 1910 */ 108, 220, 220, 316, 220, 285, 268, 115, 229, 117, |
| 175320 | + /* 1920 */ 118, 119, 223, 321, 122, 268, 149, 146, 22, 19, |
| 175321 | + /* 1930 */ 20, 202, 22, 159, 282, 134, 321, 148, 280, 147, |
| 175322 | + /* 1940 */ 139, 140, 252, 141, 25, 204, 36, 252, 13, 251, |
| 175323 | + /* 1950 */ 196, 248, 250, 249, 196, 6, 154, 155, 156, 157, |
| 175324 | + /* 1960 */ 158, 209, 194, 194, 163, 194, 306, 306, 303, 224, |
| 175325 | + /* 1970 */ 60, 215, 215, 209, 215, 215, 215, 224, 216, 216, |
| 175326 | + /* 1980 */ 4, 209, 72, 3, 22, 183, 164, 15, 23, 16, |
| 175327 | + /* 1990 */ 23, 140, 152, 131, 25, 24, 143, 20, 16, 145, |
| 175328 | + /* 2000 */ 1, 143, 131, 62, 131, 37, 54, 152, 54, 54, |
| 175329 | + /* 2010 */ 54, 101, 131, 117, 1, 34, 142, 107, 108, 5, |
| 175330 | + /* 2020 */ 22, 116, 162, 76, 41, 115, 69, 117, 118, 119, |
| 175331 | + /* 2030 */ 1, 2, 122, 25, 5, 69, 142, 116, 20, 10, |
| 174948 | 175332 | /* 2040 */ 11, 12, 13, 14, 24, 19, 17, 132, 5, 126, |
| 174949 | 175333 | /* 2050 */ 22, 141, 68, 10, 11, 12, 13, 14, 22, 30, |
| 174950 | 175334 | /* 2060 */ 17, 32, 22, 22, 154, 155, 156, 157, 158, 40, |
| 174951 | 175335 | /* 2070 */ 23, 68, 60, 30, 24, 32, 97, 28, 22, 68, |
| 174952 | 175336 | /* 2080 */ 23, 37, 34, 40, 150, 22, 25, 23, 23, 23, |
| 174953 | | - /* 2090 */ 22, 98, 23, 183, 23, 117, 34, 22, 25, 89, |
| 174954 | | - /* 2100 */ 71, 142, 144, 76, 34, 23, 34, 76, 79, 87, |
| 174955 | | - /* 2110 */ 34, 82, 34, 94, 71, 34, 22, 24, 44, 34, |
| 174956 | | - /* 2120 */ 25, 25, 79, 23, 23, 82, 143, 23, 99, 143, |
| 174957 | | - /* 2130 */ 23, 22, 11, 25, 23, 25, 22, 22, 22, 1, |
| 174958 | | - /* 2140 */ 23, 23, 99, 136, 22, 22, 142, 142, 142, 25, |
| 174959 | | - /* 2150 */ 25, 23, 15, 1, 322, 322, 322, 322, 322, 322, |
| 174960 | | - /* 2160 */ 322, 322, 322, 134, 322, 322, 322, 322, 139, 140, |
| 174961 | | - /* 2170 */ 322, 322, 322, 322, 322, 322, 322, 134, 322, 322, |
| 174962 | | - /* 2180 */ 322, 322, 139, 140, 322, 322, 322, 322, 322, 322, |
| 174963 | | - /* 2190 */ 322, 322, 163, 322, 322, 322, 322, 322, 322, 322, |
| 174964 | | - /* 2200 */ 322, 322, 322, 322, 322, 322, 163, 322, 322, 322, |
| 174965 | | - /* 2210 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174966 | | - /* 2220 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174967 | | - /* 2230 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174968 | | - /* 2240 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174969 | | - /* 2250 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174970 | | - /* 2260 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174971 | | - /* 2270 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174972 | | - /* 2280 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174973 | | - /* 2290 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174974 | | - /* 2300 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174975 | | - /* 2310 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174976 | | - /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174977 | | - /* 2330 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, |
| 174978 | | - /* 2340 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, |
| 174979 | | - /* 2350 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, |
| 174980 | | - /* 2360 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, |
| 174981 | | - /* 2370 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, |
| 174982 | | - /* 2380 */ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, |
| 174983 | | - /* 2390 */ 186, 186, 186, |
| 175337 | + /* 2090 */ 22, 98, 142, 183, 23, 23, 34, 22, 25, 89, |
| 175338 | + /* 2100 */ 71, 34, 117, 144, 34, 22, 76, 76, 79, 87, |
| 175339 | + /* 2110 */ 34, 82, 34, 44, 71, 94, 34, 23, 25, 24, |
| 175340 | + /* 2120 */ 34, 25, 79, 23, 23, 82, 23, 23, 99, 143, |
| 175341 | + /* 2130 */ 143, 22, 25, 25, 23, 22, 11, 22, 22, 25, |
| 175342 | + /* 2140 */ 23, 23, 99, 22, 22, 136, 142, 142, 142, 25, |
| 175343 | + /* 2150 */ 23, 15, 1, 1, 323, 323, 323, 323, 323, 323, |
| 175344 | + /* 2160 */ 323, 323, 323, 134, 323, 323, 323, 323, 139, 140, |
| 175345 | + /* 2170 */ 323, 323, 323, 323, 323, 323, 323, 134, 323, 323, |
| 175346 | + /* 2180 */ 323, 323, 139, 140, 323, 323, 323, 323, 323, 323, |
| 175347 | + /* 2190 */ 323, 323, 163, 323, 323, 323, 323, 323, 323, 323, |
| 175348 | + /* 2200 */ 323, 323, 323, 323, 323, 323, 163, 323, 323, 323, |
| 175349 | + /* 2210 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175350 | + /* 2220 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175351 | + /* 2230 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175352 | + /* 2240 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175353 | + /* 2250 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175354 | + /* 2260 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175355 | + /* 2270 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175356 | + /* 2280 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175357 | + /* 2290 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175358 | + /* 2300 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175359 | + /* 2310 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175360 | + /* 2320 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175361 | + /* 2330 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, |
| 175362 | + /* 2340 */ 323, 187, 187, 187, 187, 187, 187, 187, 187, 187, |
| 175363 | + /* 2350 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, |
| 175364 | + /* 2360 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, |
| 175365 | + /* 2370 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, |
| 175366 | + /* 2380 */ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, |
| 175367 | + /* 2390 */ 187, 187, 187, 187, |
| 174984 | 175368 | }; |
| 174985 | 175369 | #define YY_SHIFT_COUNT (582) |
| 174986 | 175370 | #define YY_SHIFT_MIN (0) |
| 174987 | 175371 | #define YY_SHIFT_MAX (2152) |
| 174988 | 175372 | static const unsigned short int yy_shift_ofst[] = { |
| 174989 | | - /* 0 */ 2029, 1801, 2043, 1380, 1380, 33, 391, 1496, 1569, 1642, |
| 174990 | | - /* 10 */ 702, 702, 702, 193, 33, 33, 33, 33, 33, 0, |
| 175373 | + /* 0 */ 2029, 1801, 2043, 1380, 1380, 318, 271, 1496, 1569, 1642, |
| 175374 | + /* 10 */ 702, 702, 702, 740, 318, 318, 318, 318, 318, 0, |
| 174991 | 175375 | /* 20 */ 0, 216, 1177, 702, 702, 702, 702, 702, 702, 702, |
| 174992 | | - /* 30 */ 702, 702, 702, 702, 702, 702, 702, 702, 406, 406, |
| 174993 | | - /* 40 */ 111, 111, 218, 447, 547, 598, 598, 260, 260, 260, |
| 174994 | | - /* 50 */ 260, 40, 112, 320, 340, 445, 489, 593, 637, 741, |
| 175376 | + /* 30 */ 702, 702, 702, 702, 702, 702, 702, 702, 503, 503, |
| 175377 | + /* 40 */ 111, 111, 217, 287, 348, 610, 610, 736, 736, 736, |
| 175378 | + /* 50 */ 736, 40, 112, 320, 340, 445, 489, 593, 637, 741, |
| 174995 | 175379 | /* 60 */ 785, 889, 909, 1023, 1043, 1157, 1177, 1177, 1177, 1177, |
| 174996 | 175380 | /* 70 */ 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, |
| 174997 | 175381 | /* 80 */ 1177, 1177, 1177, 1177, 1197, 1177, 1301, 1321, 1321, 554, |
| 174998 | 175382 | /* 90 */ 1802, 1910, 702, 702, 702, 702, 702, 702, 702, 702, |
| 174999 | 175383 | /* 100 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, |
| 175000 | 175384 | /* 110 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, |
| 175001 | 175385 | /* 120 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, |
| 175002 | 175386 | /* 130 */ 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, |
| 175003 | 175387 | /* 140 */ 702, 702, 138, 198, 198, 198, 198, 198, 198, 198, |
| 175004 | | - /* 150 */ 183, 99, 236, 292, 598, 793, 167, 598, 598, 880, |
| 175005 | | - /* 160 */ 880, 598, 857, 150, 195, 195, 195, 264, 113, 113, |
| 175006 | | - /* 170 */ 2207, 2207, 854, 854, 854, 751, 765, 765, 765, 765, |
| 175007 | | - /* 180 */ 1096, 1096, 725, 292, 882, 904, 598, 598, 598, 598, |
| 175008 | | - /* 190 */ 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, |
| 175009 | | - /* 200 */ 598, 598, 598, 598, 598, 1273, 1032, 1032, 598, 147, |
| 175010 | | - /* 210 */ 1098, 1098, 603, 603, 1276, 1276, 363, 2207, 2207, 2207, |
| 175011 | | - /* 220 */ 2207, 2207, 2207, 2207, 469, 617, 617, 801, 336, 461, |
| 175012 | | - /* 230 */ 804, 864, 615, 891, 913, 598, 598, 598, 598, 598, |
| 175013 | | - /* 240 */ 598, 598, 598, 598, 598, 653, 598, 598, 598, 598, |
| 175014 | | - /* 250 */ 598, 598, 598, 598, 598, 598, 598, 598, 1105, 1105, |
| 175015 | | - /* 260 */ 1105, 598, 598, 598, 1194, 598, 598, 598, 1215, 1249, |
| 175016 | | - /* 270 */ 598, 1353, 598, 598, 598, 598, 598, 598, 598, 598, |
| 175017 | | - /* 280 */ 677, 449, 902, 1338, 1338, 1338, 1338, 1248, 902, 902, |
| 175018 | | - /* 290 */ 326, 1151, 1047, 755, 749, 1371, 960, 1371, 1007, 1162, |
| 175019 | | - /* 300 */ 749, 749, 1162, 749, 960, 1007, 1274, 738, 215, 1300, |
| 175020 | | - /* 310 */ 1300, 1300, 1395, 1395, 1395, 1395, 1368, 1368, 1033, 1414, |
| 175021 | | - /* 320 */ 1387, 1361, 1759, 1759, 1685, 1685, 1792, 1792, 1685, 1683, |
| 175022 | | - /* 330 */ 1686, 1814, 1797, 1825, 1825, 1825, 1825, 1685, 1836, 1707, |
| 175023 | | - /* 340 */ 1686, 1686, 1707, 1814, 1797, 1707, 1797, 1707, 1685, 1836, |
| 175024 | | - /* 350 */ 1710, 1807, 1685, 1836, 1854, 1685, 1836, 1685, 1836, 1854, |
| 175025 | | - /* 360 */ 1769, 1769, 1769, 1822, 1870, 1870, 1854, 1769, 1766, 1769, |
| 175026 | | - /* 370 */ 1822, 1769, 1769, 1729, 1873, 1785, 1785, 1854, 1685, 1823, |
| 175027 | | - /* 380 */ 1823, 1840, 1840, 1778, 1782, 1909, 1685, 1779, 1778, 1789, |
| 175028 | | - /* 390 */ 1800, 1707, 1919, 1939, 1939, 1948, 1948, 1948, 2207, 2207, |
| 175388 | + /* 150 */ 183, 99, 169, 549, 610, 151, 542, 610, 610, 1017, |
| 175389 | + /* 160 */ 1017, 610, 1001, 350, 464, 464, 464, 586, 1, 1, |
| 175390 | + /* 170 */ 2207, 2207, 854, 854, 854, 465, 694, 694, 694, 694, |
| 175391 | + /* 180 */ 1096, 1096, 825, 549, 847, 904, 610, 610, 610, 610, |
| 175392 | + /* 190 */ 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, |
| 175393 | + /* 200 */ 610, 610, 610, 610, 610, 488, 947, 947, 610, 1129, |
| 175394 | + /* 210 */ 495, 495, 1139, 1139, 967, 967, 1173, 2207, 2207, 2207, |
| 175395 | + /* 220 */ 2207, 2207, 2207, 2207, 617, 765, 765, 697, 444, 708, |
| 175396 | + /* 230 */ 660, 745, 510, 663, 864, 610, 610, 610, 610, 610, |
| 175397 | + /* 240 */ 610, 610, 610, 610, 610, 188, 610, 610, 610, 610, |
| 175398 | + /* 250 */ 610, 610, 610, 610, 610, 610, 610, 610, 839, 839, |
| 175399 | + /* 260 */ 839, 610, 610, 610, 1155, 610, 610, 610, 1119, 1247, |
| 175400 | + /* 270 */ 610, 1353, 610, 610, 610, 610, 610, 610, 610, 610, |
| 175401 | + /* 280 */ 1063, 494, 1101, 291, 291, 291, 291, 1319, 1101, 1101, |
| 175402 | + /* 290 */ 775, 1221, 1375, 1452, 667, 1341, 1198, 1341, 1435, 1487, |
| 175403 | + /* 300 */ 667, 667, 1487, 667, 1198, 1435, 777, 1011, 1423, 584, |
| 175404 | + /* 310 */ 584, 584, 1273, 1273, 1273, 1273, 1471, 1471, 880, 1530, |
| 175405 | + /* 320 */ 1190, 1095, 1731, 1731, 1668, 1668, 1794, 1794, 1668, 1683, |
| 175406 | + /* 330 */ 1685, 1815, 1796, 1824, 1824, 1824, 1824, 1668, 1828, 1701, |
| 175407 | + /* 340 */ 1685, 1685, 1701, 1815, 1796, 1701, 1796, 1701, 1668, 1828, |
| 175408 | + /* 350 */ 1697, 1800, 1668, 1828, 1848, 1668, 1828, 1668, 1828, 1848, |
| 175409 | + /* 360 */ 1766, 1766, 1766, 1823, 1870, 1870, 1848, 1766, 1767, 1766, |
| 175410 | + /* 370 */ 1823, 1766, 1766, 1727, 1872, 1783, 1783, 1848, 1668, 1813, |
| 175411 | + /* 380 */ 1813, 1825, 1825, 1777, 1781, 1906, 1668, 1774, 1777, 1789, |
| 175412 | + /* 390 */ 1792, 1701, 1919, 1935, 1935, 1949, 1949, 1949, 2207, 2207, |
| 175029 | 175413 | /* 400 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, |
| 175030 | | - /* 410 */ 2207, 2207, 2207, 69, 1037, 79, 1088, 651, 1196, 1415, |
| 175031 | | - /* 420 */ 1501, 1439, 1369, 1452, 911, 1211, 1524, 1469, 1551, 1567, |
| 175032 | | - /* 430 */ 1570, 1624, 1640, 1644, 1499, 1440, 1572, 1464, 1597, 275, |
| 175033 | | - /* 440 */ 782, 1586, 1648, 1678, 1553, 1682, 1687, 1388, 1502, 1696, |
| 175034 | | - /* 450 */ 1706, 1588, 1486, 1971, 1975, 1957, 1820, 1972, 1973, 1965, |
| 175035 | | - /* 460 */ 1967, 1851, 1841, 1861, 1969, 1969, 1974, 1852, 1976, 1855, |
| 175036 | | - /* 470 */ 1981, 1998, 1858, 1871, 1969, 1872, 1942, 1968, 1969, 1856, |
| 175037 | | - /* 480 */ 1952, 1953, 1955, 1956, 1881, 1896, 1980, 1874, 2014, 2015, |
| 175038 | | - /* 490 */ 1997, 1905, 1860, 1954, 1999, 1964, 1950, 1994, 1894, 1921, |
| 175414 | + /* 410 */ 2207, 2207, 2207, 69, 1032, 79, 357, 1377, 1206, 400, |
| 175415 | + /* 420 */ 1525, 835, 332, 1540, 1437, 1539, 1536, 1548, 1583, 1620, |
| 175416 | + /* 430 */ 1633, 1670, 1671, 1674, 1567, 1553, 1682, 1506, 1675, 1358, |
| 175417 | + /* 440 */ 1607, 1589, 1678, 1681, 1624, 1687, 1688, 1283, 1561, 1693, |
| 175418 | + /* 450 */ 1696, 1623, 1521, 1976, 1980, 1962, 1822, 1972, 1973, 1965, |
| 175419 | + /* 460 */ 1967, 1851, 1840, 1862, 1969, 1969, 1971, 1853, 1977, 1854, |
| 175420 | + /* 470 */ 1982, 1999, 1858, 1871, 1969, 1873, 1941, 1968, 1969, 1855, |
| 175421 | + /* 480 */ 1952, 1954, 1955, 1956, 1881, 1896, 1981, 1874, 2013, 2014, |
| 175422 | + /* 490 */ 1998, 1905, 1860, 1957, 2008, 1966, 1947, 1983, 1894, 1921, |
| 175039 | 175423 | /* 500 */ 2020, 2018, 2026, 1915, 1923, 2028, 1984, 2036, 2040, 2047, |
| 175040 | 175424 | /* 510 */ 2041, 2003, 2012, 2050, 1979, 2049, 2056, 2011, 2044, 2057, |
| 175041 | | - /* 520 */ 2048, 1934, 2063, 2064, 2065, 2061, 2066, 2068, 1993, 1959, |
| 175042 | | - /* 530 */ 2069, 2071, 1978, 2062, 2075, 1958, 2073, 2070, 2072, 2076, |
| 175043 | | - /* 540 */ 2078, 2010, 2027, 2022, 2074, 2031, 2019, 2081, 2082, 2094, |
| 175044 | | - /* 550 */ 2093, 2095, 2096, 2085, 1983, 1986, 2100, 2073, 2101, 2104, |
| 175045 | | - /* 560 */ 2107, 2109, 2108, 2110, 2111, 2114, 2121, 2115, 2116, 2117, |
| 175046 | | - /* 570 */ 2118, 2122, 2123, 2124, 2007, 2004, 2005, 2006, 2125, 2128, |
| 175047 | | - /* 580 */ 2137, 2138, 2152, |
| 175425 | + /* 520 */ 2048, 1934, 2063, 2064, 2065, 2061, 2066, 2068, 1993, 1950, |
| 175426 | + /* 530 */ 2071, 2072, 1985, 2062, 2075, 1959, 2073, 2067, 2070, 2076, |
| 175427 | + /* 540 */ 2078, 2010, 2030, 2022, 2069, 2031, 2021, 2082, 2094, 2083, |
| 175428 | + /* 550 */ 2095, 2093, 2096, 2086, 1986, 1987, 2100, 2073, 2101, 2103, |
| 175429 | + /* 560 */ 2104, 2109, 2107, 2108, 2111, 2113, 2125, 2115, 2116, 2117, |
| 175430 | + /* 570 */ 2118, 2121, 2122, 2114, 2009, 2004, 2005, 2006, 2124, 2127, |
| 175431 | + /* 580 */ 2136, 2151, 2152, |
| 175048 | 175432 | }; |
| 175049 | 175433 | #define YY_REDUCE_COUNT (412) |
| 175050 | | -#define YY_REDUCE_MIN (-276) |
| 175051 | | -#define YY_REDUCE_MAX (1775) |
| 175434 | +#define YY_REDUCE_MIN (-277) |
| 175435 | +#define YY_REDUCE_MAX (1772) |
| 175052 | 175436 | static const short yy_reduce_ofst[] = { |
| 175053 | | - /* 0 */ -66, 217, -63, -177, -180, 161, 364, 64, -183, 162, |
| 175054 | | - /* 10 */ 223, 367, 414, -173, 473, 514, 525, 622, 626, -207, |
| 175055 | | - /* 20 */ 351, -276, -38, 693, 811, 831, 833, 888, -188, 945, |
| 175056 | | - /* 30 */ 947, 416, 558, 951, 867, 287, 1078, 1080, -186, 224, |
| 175057 | | - /* 40 */ -132, 42, 964, 269, 417, 796, 810, -237, -231, -237, |
| 175058 | | - /* 50 */ -231, -45, -45, -45, -45, -45, -45, -45, -45, -45, |
| 175059 | | - /* 60 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, |
| 175060 | | - /* 70 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, |
| 175061 | | - /* 80 */ -45, -45, -45, -45, -45, -45, -45, -45, -45, 895, |
| 175062 | | - /* 90 */ 925, 967, 980, 1100, 1143, 1169, 1203, 1225, 1228, 1242, |
| 175063 | | - /* 100 */ 1247, 1250, 1253, 1255, 1261, 1267, 1272, 1275, 1283, 1286, |
| 175064 | | - /* 110 */ 1288, 1292, 1333, 1335, 1347, 1349, 1352, 1354, 1360, 1366, |
| 175065 | | - /* 120 */ 1381, 1391, 1406, 1408, 1413, 1416, 1418, 1422, 1425, 1427, |
| 175066 | | - /* 130 */ 1463, 1465, 1472, 1478, 1480, 1491, 1498, 1500, 1517, 1519, |
| 175067 | | - /* 140 */ 1528, 1536, -45, -45, -45, -45, -45, -45, -45, -45, |
| 175068 | | - /* 150 */ -45, -45, -45, 312, -158, 285, -219, 9, 166, 370, |
| 175069 | | - /* 160 */ 545, 707, -45, 930, 601, 963, 1067, 792, -45, -45, |
| 175070 | | - /* 170 */ -45, -45, -204, -204, -204, 369, -171, -129, 632, 678, |
| 175071 | | - /* 180 */ 202, 352, -270, 412, 627, 627, -9, 122, 415, 419, |
| 175072 | | - /* 190 */ -56, 248, 583, 920, 6, 261, 459, 795, 1049, 813, |
| 175073 | | - /* 200 */ 1062, 1082, -161, 778, 1063, 797, 870, 1003, 1128, 443, |
| 175074 | | - /* 210 */ 1031, 1072, 1191, 1192, 957, 1120, 105, 1149, 523, 933, |
| 175075 | | - /* 220 */ 1218, 1238, 1254, 1251, -138, 96, 117, 146, 181, 277, |
| 175076 | | - /* 230 */ 280, 421, 480, 712, 830, 850, 1085, 1099, 1129, 1209, |
| 175077 | | - /* 240 */ 1323, 1331, 1336, 1364, 1407, 368, 1412, 1433, 1438, 1474, |
| 175078 | | - /* 250 */ 1481, 1505, 1506, 1526, 1538, 1544, 1545, 1546, 722, 764, |
| 175079 | | - /* 260 */ 856, 1547, 1548, 1550, 1188, 1554, 1557, 1561, 1298, 1260, |
| 175080 | | - /* 270 */ 1562, 1456, 1564, 280, 1568, 1571, 1573, 1574, 1575, 1576, |
| 175081 | | - /* 280 */ 1457, 1477, 1520, 1514, 1515, 1516, 1518, 1188, 1520, 1520, |
| 175082 | | - /* 290 */ 1530, 1563, 1584, 1482, 1504, 1510, 1534, 1513, 1488, 1537, |
| 175083 | | - /* 300 */ 1512, 1521, 1539, 1522, 1541, 1493, 1583, 1559, 1565, 1585, |
| 175084 | | - /* 310 */ 1587, 1589, 1529, 1531, 1532, 1549, 1558, 1566, 1535, 1577, |
| 175085 | | - /* 320 */ 1582, 1622, 1533, 1540, 1627, 1628, 1552, 1555, 1633, 1560, |
| 175086 | | - /* 330 */ 1578, 1581, 1607, 1606, 1608, 1609, 1611, 1649, 1655, 1612, |
| 175087 | | - /* 340 */ 1590, 1591, 1613, 1594, 1621, 1614, 1623, 1616, 1666, 1668, |
| 175088 | | - /* 350 */ 1579, 1593, 1672, 1675, 1656, 1676, 1679, 1680, 1688, 1660, |
| 175089 | | - /* 360 */ 1667, 1670, 1671, 1663, 1669, 1673, 1674, 1689, 1681, 1692, |
| 175090 | | - /* 370 */ 1677, 1693, 1694, 1592, 1599, 1617, 1620, 1700, 1713, 1596, |
| 175091 | | - /* 380 */ 1598, 1658, 1659, 1691, 1684, 1654, 1735, 1664, 1697, 1690, |
| 175092 | | - /* 390 */ 1701, 1703, 1748, 1758, 1760, 1768, 1770, 1772, 1657, 1661, |
| 175093 | | - /* 400 */ 1665, 1761, 1754, 1757, 1762, 1763, 1764, 1750, 1751, 1765, |
|