Fossil

Check-in [dffe11c2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update to the latest version of SQLite (3.6.20rc1) and fix some compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dffe11c29c10e82a8e293e2945b6eb6bd0decf9d
User & Date: drh 2009-11-01 19:25:47
Context
2009-11-01
19:49
Add the ⟾ mark after external hyperlinks in wiki. check-in: 0039b781 user: drh tags: trunk
19:25
Update to the latest version of SQLite (3.6.20rc1) and fix some compiler warnings. check-in: dffe11c2 user: drh tags: trunk
2009-10-31
17:01
Add the "artifact" command for extracting the content of individual artifacts. The new "artifact" command is really just a renaming of "test-content-get". check-in: 8480dd38 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/sqlite3.c.

1
2
3
4
5
6
7
8
9
10
..
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
...
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
....
1363
1364
1365
1366
1367
1368
1369



1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382






1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
....
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
....
2946
2947
2948
2949
2950
2951
2952








2953
2954
2955
2956
2957
2958
2959
....
3478
3479
3480
3481
3482
3483
3484


3485
3486
3487
3488
3489
3490
3491
....
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
....
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
....
7532
7533
7534
7535
7536
7537
7538


7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
....
9199
9200
9201
9202
9203
9204
9205
9206

9207
9208
9209
9210
9211
9212
9213
....
9741
9742
9743
9744
9745
9746
9747

9748
9749
9750
9751
9752
9753
9754
.....
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
.....
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
.....
10484
10485
10486
10487
10488
10489
10490

10491
10492
10493
10494
10495
10496
10497
.....
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
.....
17826
17827
17828
17829
17830
17831
17832

17833
17834
17835
17836
17837
17838
17839
.....
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
.....
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
.....
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
.....
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378

18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
.....
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
.....
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
.....
24100
24101
24102
24103
24104
24105
24106
24107

24108
24109
24110
24111
24112
24113
24114
.....
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
.....
28419
28420
28421
28422
28423
28424
28425
28426
28427
28428
28429
28430
28431
28432
28433
28434


























28435
28436
28437
28438
28439
28440


28441
28442
28443





28444
28445
28446








28447
28448
28449
28450
28451
28452
28453
.....
28807
28808
28809
28810
28811
28812
28813
28814
28815
28816
28817
28818
28819
28820
28821
28822
28823
28824
28825
28826
28827
28828
.....
36673
36674
36675
36676
36677
36678
36679
36680
36681
36682
36683
36684
36685
36686
36687
36688
36689
.....
36953
36954
36955
36956
36957
36958
36959
36960
36961
36962
36963
36964
36965
36966
36967
36968
.....
37095
37096
37097
37098
37099
37100
37101
37102
37103
37104
37105
37106
37107
37108
37109
.....
37699
37700
37701
37702
37703
37704
37705
37706

37707
37708


37709
37710
37711
37712
37713
37714
37715
37716
37717
37718
37719
37720
37721
37722
37723
37724
37725
37726
37727
37728
37729
37730
37731
37732
37733
37734
37735
37736
37737
37738
37739
37740
37741
37742
37743
37744
37745
37746
37747









37748
37749
37750
37751
37752
37753
37754
.....
37773
37774
37775
37776
37777
37778
37779

37780

37781
37782
37783
37784








37785

37786
37787

37788
37789
37790
37791
37792
37793
37794
.....
37799
37800
37801
37802
37803
37804
37805
37806
37807
37808
37809
37810
37811
37812
37813
.....
37820
37821
37822
37823
37824
37825
37826
37827
37828
37829
37830
37831
37832
37833
37834
.....
37866
37867
37868
37869
37870
37871
37872
37873
37874
37875
37876
37877
37878
37879
37880
37881
37882
37883
.....
37934
37935
37936
37937
37938
37939
37940
37941
37942
37943
37944
37945
37946
37947
37948
37949
37950
.....
37969
37970
37971
37972
37973
37974
37975
37976
37977
37978
37979
37980
37981
37982
37983
37984
37985
37986
37987
37988
37989
37990
37991
37992
37993
37994
37995
37996
37997
.....
38004
38005
38006
38007
38008
38009
38010


38011
38012
38013

38014
38015
38016
38017
38018
38019
38020
.....
38037
38038
38039
38040
38041
38042
38043
38044
38045
38046
38047
38048
38049
38050
38051
38052
38053
38054
38055
38056
38057
38058
38059
38060
.....
38064
38065
38066
38067
38068
38069
38070

38071
38072
38073
38074
38075
38076
38077
38078
38079
38080
38081
.....
38100
38101
38102
38103
38104
38105
38106
38107
38108
38109
38110
38111
38112
38113
38114
.....
38196
38197
38198
38199
38200
38201
38202
38203
38204
38205
38206
38207
38208
38209
38210
38211
.....
38602
38603
38604
38605
38606
38607
38608
38609




38610
38611
38612
38613
38614
38615
38616
.....
40574
40575
40576
40577
40578
40579
40580
40581
40582
40583
40584
40585
40586
40587
40588
40589
40590
40591
40592




40593
40594
40595
40596
40597
40598
40599
.....
44045
44046
44047
44048
44049
44050
44051
44052
44053
44054
44055
44056
44057
44058
44059
.....
47101
47102
47103
47104
47105
47106
47107



47108
47109
47110
47111
47112
47113
47114
.....
47205
47206
47207
47208
47209
47210
47211

47212
47213
47214
47215
47216
47217
47218
47219
47220
47221
47222
47223
47224
47225
.....
48165
48166
48167
48168
48169
48170
48171
48172
48173
48174
48175
48176
48177
48178
48179
48180
48181
48182
48183
48184
48185
48186
48187
48188
48189
48190
48191
48192
48193
48194
48195
48196
48197
48198
48199
.....
50174
50175
50176
50177
50178
50179
50180







































50181
50182
50183
50184
50185
50186
50187
.....
50275
50276
50277
50278
50279
50280
50281



50282
50283
50284
50285
50286
50287
50288
.....
50481
50482
50483
50484
50485
50486
50487
50488
50489
50490
50491
50492
50493
50494
50495
.....
51091
51092
51093
51094
51095
51096
51097









51098
51099
51100
51101
51102
51103
51104
.....
51340
51341
51342
51343
51344
51345
51346






51347
51348
51349
51350
51351
51352
51353
.....
51536
51537
51538
51539
51540
51541
51542
51543
51544
51545
51546
51547
51548
51549
51550
51551
51552
51553
51554
51555
.....
51712
51713
51714
51715
51716
51717
51718
51719
51720
51721
51722
51723
51724
51725
51726
.....
52261
52262
52263
52264
52265
52266
52267
52268
52269
52270
52271
52272
52273
52274
52275
.....
52905
52906
52907
52908
52909
52910
52911
52912
52913
52914
52915
52916
52917
52918
52919
.....
53056
53057
53058
53059
53060
53061
53062
53063
53064
53065
53066
53067
53068
53069
53070
.....
53281
53282
53283
53284
53285
53286
53287
53288
53289
53290
53291
53292
53293
53294
53295
.....
54777
54778
54779
54780
54781
54782
54783

54784
54785
54786
54787
54788
54789
54790
.....
54897
54898
54899
54900
54901
54902
54903





54904
54905
54906
54907
54908
54909
54910
.....
55696
55697
55698
55699
55700
55701
55702





55703

55704
55705
55706
55707
55708
55709
55710
55711
55712
55713
55714
55715
55716
55717
55718
55719
55720
55721
55722
55723
55724
55725
55726
55727




55728





55729
55730
55731
55732
55733
55734
55735
55736
55737
.....
57041
57042
57043
57044
57045
57046
57047
57048
57049
57050
57051
57052
57053
57054
57055
.....
57339
57340
57341
57342
57343
57344
57345
57346
57347
57348
57349
57350
57351
57352
57353
.....
57551
57552
57553
57554
57555
57556
57557
57558
57559
57560
57561
57562
57563
57564
57565
.....
59172
59173
59174
59175
59176
59177
59178





















59179
59180
59181
59182
59183
59184
59185
.....
60520
60521
60522
60523
60524
60525
60526
60527
60528
60529
60530
60531
60532
60533
60534
60535
60536
60537
60538
60539
.....
60549
60550
60551
60552
60553
60554
60555
60556
60557
60558
60559
60560
60561
60562
60563
60564
60565
60566
60567
60568
.....
61320
61321
61322
61323
61324
61325
61326


61327
61328
61329
61330
61331
61332
61333
.....
61398
61399
61400
61401
61402
61403
61404
61405
61406
61407
61408
61409
61410
61411
61412
.....
61445
61446
61447
61448
61449
61450
61451



61452
61453
61454
61455
61456
61457
61458
61459
61460

61461
61462
61463
61464
61465
61466
61467
61468
61469
.....
61520
61521
61522
61523
61524
61525
61526
61527
61528
61529
61530
61531
61532
61533
61534
.....
61551
61552
61553
61554
61555
61556
61557

61558
61559
61560
61561
61562
61563
61564
61565
61566
61567
61568
61569



61570
61571
61572

61573
61574
61575
61576
61577

61578
61579
61580
61581
61582
61583
61584
.....
61614
61615
61616
61617
61618
61619
61620
61621
61622
61623
61624
61625
61626
61627
61628
61629
61630
61631
61632
61633
61634
61635
61636
61637
61638
61639
61640
61641
.....
62113
62114
62115
62116
62117
62118
62119
62120
62121
62122
62123
62124
62125
62126
62127
62128
62129
62130
62131
62132
62133
62134
62135
62136
62137
62138
.....
62384
62385
62386
62387
62388
62389
62390
62391
62392
62393
62394
62395
62396
62397
62398
62399
.....
62750
62751
62752
62753
62754
62755
62756

62757
62758
62759
62760
62761
62762
62763
.....
62823
62824
62825
62826
62827
62828
62829

62830
62831
62832
62833
62834
62835
62836
.....
78183
78184
78185
78186
78187
78188
78189

78190
78191
78192
78193
78194
78195
78196
.....
78197
78198
78199
78200
78201
78202
78203

78204
78205
78206
78207
78208
78209
78210
.....
78354
78355
78356
78357
78358
78359
78360

78361
78362
78363
78364
78365
78366
78367
78368
78369
78370
78371
78372
78373
78374
78375
78376
78377
78378
78379
78380
78381
78382
.....
78394
78395
78396
78397
78398
78399
78400
78401
78402
78403
78404
78405
78406
78407
78408
.....
78428
78429
78430
78431
78432
78433
78434
78435
78436
78437
78438
78439
78440
78441
78442
78443
78444
78445
78446
78447
78448
78449
78450
78451
78452
78453
78454
.....
78474
78475
78476
78477
78478
78479
78480
78481
78482
78483
78484
78485
78486
78487
78488
.....
78722
78723
78724
78725
78726
78727
78728
78729


78730
78731
78732
78733
78734

78735

78736
78737
78738
78739
78740
78741
78742
78743
78744
78745
78746
78747
78748
78749

78750
78751
78752
78753

78754
78755
78756
78757
78758
78759
78760
78761


78762
78763
78764
78765
78766
78767
78768
78769
78770
78771
78772
78773
78774
78775
78776
78777
78778
78779
78780
.....
78848
78849
78850
78851
78852
78853
78854
78855

78856
78857
78858
78859
78860
78861
78862
78863
78864
78865
78866
.....
78885
78886
78887
78888
78889
78890
78891
78892


78893
78894
78895
78896
78897
78898
78899
78900
78901
78902
78903
78904
78905
78906
.....
84633
84634
84635
84636
84637
84638
84639
84640
84641
84642
84643
84644
84645
84646
84647
84648
84649
84650
84651
84652
84653
84654
84655
84656
84657
84658
.....
84814
84815
84816
84817
84818
84819
84820






84821
84822
84823
84824
84825
84826
84827
.....
84868
84869
84870
84871
84872
84873
84874
84875
84876
84877
84878
84879
84880
84881
84882
84883
84884
84885
84886
84887
84888
.....
84890
84891
84892
84893
84894
84895
84896
84897
84898
84899
84900
84901
84902
84903
84904
84905
84906
84907
84908
84909
84910
84911
84912
84913
84914
84915
84916
84917
84918
.....
86578
86579
86580
86581
86582
86583
86584
86585
86586
86587
86588
86589
86590
86591
86592
86593
86594
86595
86596


86597
86598
86599
86600
86601
86602
86603
86604
86605
86606
86607
86608
86609
86610


86611
86612

86613
86614
86615

86616
86617







86618
86619
86620















86621
86622


86623
86624
86625
86626
86627

86628
86629
86630
















86631
86632






86633
86634
86635
86636
86637
86638
86639
86640
.....
87007
87008
87009
87010
87011
87012
87013
87014
87015
87016
87017
87018
87019
87020
87021
87022
87023
87024
.....
87145
87146
87147
87148
87149
87150
87151
87152
87153
87154
87155
87156
87157
87158
87159
87160
87161
87162
87163
87164
87165
87166
87167
87168
87169
87170
87171
87172
87173
.....
87937
87938
87939
87940
87941
87942
87943




































87944
87945
87946
87947
87948
87949
87950
.....
87989
87990
87991
87992
87993
87994
87995
87996
87997
87998
87999
88000


88001
88002
88003
88004
88005
88006
88007
88008
88009
88010
88011
88012
88013
88014
88015
88016
88017
88018
88019
.....
90175
90176
90177
90178
90179
90180
90181
90182
90183
90184
90185
90186
90187
90188
90189
90190
90191
90192
90193
90194
90195
90196
90197
90198
90199
90200
90201
90202
90203
90204
90205
90206
90207
90208
90209
90210
90211
90212
90213
90214
90215
90216
90217
90218
90219
90220
90221
90222
90223
90224
90225
90226
90227
90228
90229
90230
90231
90232
90233
90234
90235
90236
90237
90238
90239
90240
90241
90242
90243
90244
90245
90246
90247
90248
90249
90250
90251
90252
90253
90254
90255
90256
90257
90258
90259
90260
90261
90262
90263
90264
90265
90266
90267
90268
90269
90270
90271
90272
90273
90274
90275
90276
90277
90278
90279
90280
90281
90282
90283
90284
90285
90286
90287
90288
90289
90290
90291
90292
90293
90294
90295
90296
90297
90298
90299
90300
90301
90302
90303
90304
90305
90306
90307
90308
90309
90310
90311
90312
90313
90314
90315
90316
90317
90318
90319
90320
90321
90322
90323
90324
90325
90326
90327
90328
90329
90330
90331
90332
90333
90334
90335
90336
90337
90338
90339
90340
90341
90342
90343
90344
90345
90346
90347
90348
90349
90350
90351
90352
90353
90354
90355
90356
90357
90358
90359
90360
90361
90362
90363
90364
90365
90366
90367
90368
90369
90370
90371
90372
90373
90374
90375
90376
90377
90378
90379
90380
90381
90382
90383
90384
90385
90386
90387
90388
90389
90390
90391
90392
90393
90394
90395
90396
90397
90398
90399
90400
90401
90402
90403
90404
90405
90406
90407
90408
90409
90410
90411
90412
90413
90414
90415
90416
90417
90418
90419
90420
90421
90422
90423
90424
90425
90426
90427
90428
90429
90430
90431
90432
90433
90434
90435
90436
90437
90438
90439
90440
90441
90442
90443
90444
90445
90446
90447
90448
90449
90450
90451
90452
90453
90454
90455
90456
90457
90458
90459
90460
90461
90462
90463
90464
90465
90466
90467
90468
90469
90470
90471
90472
90473
90474
90475
90476
90477
90478
90479
90480
90481
90482
90483
90484
90485
90486
90487
90488
90489
90490
90491
90492
90493
90494
90495
90496
90497
90498
90499
90500
90501
90502
90503
90504
90505
90506
90507
90508
90509
90510
90511
90512
90513
90514
90515
90516
90517
90518
90519
90520
90521
90522
90523
90524
90525
90526
90527
90528
90529
90530
90531
90532
90533
90534
90535
90536
90537
90538
90539
90540
90541
90542
90543
90544
90545
90546
90547
90548
90549
90550
90551
90552
90553
90554
90555
90556
90557
90558
90559
90560
90561
90562
90563
90564
90565
90566
90567
90568
90569
90570
90571
90572
90573
90574
90575
90576
90577
90578
90579
90580
90581
90582
90583
90584
90585
90586
90587
90588
90589
90590
90591
90592
90593
90594
90595
90596
90597
90598
90599
90600
90601
90602
90603
90604
90605
90606
90607
90608
90609
90610
90611
90612
90613
90614
90615
90616
90617
90618
90619
90620
90621
90622
90623
90624
90625
90626
90627
90628
90629
90630
90631
90632
90633
90634
90635
90636
90637
90638
90639
90640
90641
90642
90643
90644
90645
90646
90647
.....
92149
92150
92151
92152
92153
92154
92155
92156
92157
92158
92159
92160
92161
92162
92163
.....
92164
92165
92166
92167
92168
92169
92170
92171
92172
92173
92174
92175
92176
92177
92178
92179
92180
92181
92182
92183
92184
92185
92186
92187
92188
92189
92190
.....
93429
93430
93431
93432
93433
93434
93435
93436
93437
93438
93439
93440
93441
93442
93443
93444
93445
93446
93447
93448
93449
93450
93451
93452
93453
93454
93455
93456
93457
93458
93459
93460
93461
93462
93463
.....
93480
93481
93482
93483
93484
93485
93486
93487
93488
93489
93490
93491
93492
93493
93494
.....
93558
93559
93560
93561
93562
93563
93564
93565
93566
93567
93568
93569
93570
93571
93572
93573
93574
.....
95954
95955
95956
95957
95958
95959
95960
95961
95962
95963
95964
95965
95966
95967
95968
95969
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.6.19.  By combining all the individual C code files into this 
** single large file, the entire code can be compiled as a one translation
** unit.  This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately.  Performance improvements
** of 5% are more are commonly seen when SQLite is compiled as a single
** translation unit.
**
** This file is all you need to compile SQLite.  To use SQLite in other
................................................................................
** the "sqlite3.h" header file at hand, you will find a copy embedded within
** the text of this file.  Search for "Begin file sqlite3.h" to find the start
** of the embedded sqlite3.h header file.) Additional code files may be needed
** if you want a wrapper to interface SQLite with your choice of programming
** language. The code for the "sqlite3" command-line shell is also in a
** separate file. This file contains only code for the core SQLite library.
**
** This amalgamation was generated on 2009-10-14 11:34:12 UTC.
*/
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
#ifndef SQLITE_PRIVATE
# define SQLITE_PRIVATE static
#endif
#ifndef SQLITE_API
................................................................................
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION        "3.6.19"
#define SQLITE_VERSION_NUMBER 3006019
#define SQLITE_SOURCE_ID      "2009-10-14 11:33:55 c1d499afc50d54b376945b4efb65c56c787a073d"

/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
................................................................................
#endif

/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
** Applications should [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** the [sqlite3] object prior to attempting to close the object.
** The [sqlite3_next_stmt()] interface can be used to locate all
** [prepared statements] associated with a [database connection] if desired.
** Typical code might look like this:
**
** <blockquote><pre>
** sqlite3_stmt *pStmt;
** while( (pStmt = sqlite3_next_stmt(db, 0))!=0 ){
** &nbsp;   sqlite3_finalize(pStmt);
** }
** </pre></blockquote>
**
** If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
................................................................................

/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library.  The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().



**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown().  Only an effective call
** of sqlite3_initialize() does any initialization.  All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
** an effective call to sqlite3_shutdown() does any deinitialization.
** All other calls to sqlite3_shutdown() are harmless no-ops.
**






** Among other things, sqlite3_initialize() shall invoke
** sqlite3_os_init().  Similarly, sqlite3_shutdown()
** shall invoke sqlite3_os_end().
**
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
** If for some reason, sqlite3_initialize() is unable to initialize
** the library (perhaps it is unable to allocate a needed resource such
** as a mutex) it returns an [error code] other than [SQLITE_OK].
**
** The sqlite3_initialize() routine is called internally by many other
................................................................................
**
** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
** recommended for all new programs. The two older interfaces are retained
** for backwards compatibility, but their use is discouraged.
** In the "v2" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave a differently in two ways:
**
** <ol>
** <li>
** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
** always used to do, [sqlite3_step()] will automatically recompile the SQL
** statement and try to run it again.  If the schema has changed in
** a way that makes the statement no longer valid, [sqlite3_step()] will still
................................................................................
** When an error occurs, [sqlite3_step()] will return one of the detailed
** [error codes] or [extended error codes].  The legacy behavior was that
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and you would have to make a second call to [sqlite3_reset()] in order
** to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>








** </ol>
**
** Requirements:
** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021]
**
*/
SQLITE_API int sqlite3_prepare(
................................................................................
**
** These routines return information about a single column of the current
** result row of a query.  In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
** that was returned from [sqlite3_prepare_v2()] or one of its variants)
** and the second argument is the index of the column for which information
** should be returned.  The leftmost column of the result set has the index 0.


**
** If the SQL statement does not currently point to a valid row, or if the
** column index is out of range, the result is undefined.
** These routines may only be called when the most recent call to
** [sqlite3_step()] has returned [SQLITE_ROW] and neither
** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
** If any of these routines are called after [sqlite3_reset()] or
................................................................................
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
** header file that defines a number for each opcode used by the VDBE.
*/
/************** Include opcodes.h in the middle of vdbe.h ********************/
/************** Begin file opcodes.h *****************************************/
/* Automatically generated.  Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_VNext                                1
#define OP_Affinity                             2
#define OP_Column                               3
#define OP_SetCookie                            4
#define OP_Seek                                 5
#define OP_Real                               130   /* same as TK_FLOAT    */
#define OP_Sequence                             6
#define OP_Savepoint                            7
#define OP_Ge                                  80   /* same as TK_GE       */
#define OP_RowKey                               8
#define OP_SCopy                                9
#define OP_Eq                                  76   /* same as TK_EQ       */
#define OP_OpenWrite                           10
#define OP_NotNull                             74   /* same as TK_NOTNULL  */
#define OP_If                                  11
#define OP_ToInt                              144   /* same as TK_TO_INT   */
#define OP_String8                             94   /* same as TK_STRING   */
#define OP_CollSeq                             12
#define OP_OpenRead                            13
#define OP_Expire                              14
#define OP_AutoCommit                          15
#define OP_Gt                                  77   /* same as TK_GT       */
#define OP_Pagecount                           16
#define OP_IntegrityCk                         17
#define OP_Sort                                18
#define OP_Copy                                20
#define OP_Trace                               21
#define OP_Function                            22
#define OP_IfNeg                               23
#define OP_And                                 69   /* same as TK_AND      */
#define OP_Subtract                            87   /* same as TK_MINUS    */
#define OP_Noop                                24
#define OP_Program                             25
#define OP_Return                              26
#define OP_Remainder                           90   /* same as TK_REM      */
#define OP_NewRowid                            27
#define OP_Multiply                            88   /* same as TK_STAR     */
#define OP_FkCounter                           28
#define OP_Variable                            29
#define OP_String                              30
#define OP_RealAffinity                        31
#define OP_VRename                             32
#define OP_ParseSchema                         33
#define OP_VOpen                               34
#define OP_Close                               35
#define OP_CreateIndex                         36
#define OP_IsUnique                            37
#define OP_NotFound                            38
#define OP_Int64                               39
#define OP_MustBeInt                           40
#define OP_Halt                                41
#define OP_Rowid                               42
#define OP_IdxLT                               43
#define OP_AddImm                              44
#define OP_RowData                             45
#define OP_MemMax                              46
#define OP_Or                                  68   /* same as TK_OR       */
#define OP_NotExists                           47
#define OP_Gosub                               48
#define OP_Divide                              89   /* same as TK_SLASH    */
#define OP_Integer                             49
#define OP_ToNumeric                          143   /* same as TK_TO_NUMERIC*/
#define OP_Prev                                50
#define OP_RowSetRead                          51
#define OP_Concat                              91   /* same as TK_CONCAT   */
#define OP_RowSetAdd                           52
#define OP_BitAnd                              82   /* same as TK_BITAND   */
#define OP_VColumn                             53
#define OP_CreateTable                         54
#define OP_Last                                55
#define OP_SeekLe                              56
#define OP_IsNull                              73   /* same as TK_ISNULL   */
#define OP_IncrVacuum                          57
#define OP_IdxRowid                            58
#define OP_ShiftRight                          85   /* same as TK_RSHIFT   */
#define OP_ResetCount                          59
#define OP_Yield                               60
#define OP_DropTrigger                         61
#define OP_DropIndex                           62
#define OP_Param                               63
#define OP_IdxGE                               64
#define OP_IdxDelete                           65
#define OP_Vacuum                              66
#define OP_IfNot                               67
#define OP_DropTable                           70
#define OP_SeekLt                              71
#define OP_MakeRecord                          72
#define OP_ToBlob                             142   /* same as TK_TO_BLOB  */
#define OP_ResultRow                           81
#define OP_Delete                              92
#define OP_AggFinal                            95
#define OP_Compare                             96
#define OP_ShiftLeft                           84   /* same as TK_LSHIFT   */
#define OP_Goto                                97
#define OP_TableLock                           98
#define OP_Clear                               99
#define OP_Le                                  78   /* same as TK_LE       */
#define OP_VerifyCookie                       100
#define OP_AggStep                            101
#define OP_ToText                             141   /* same as TK_TO_TEXT  */
#define OP_Not                                 19   /* same as TK_NOT      */
#define OP_ToReal                             145   /* same as TK_TO_REAL  */
#define OP_Transaction                        102
#define OP_VFilter                            103
#define OP_Ne                                  75   /* same as TK_NE       */
#define OP_VDestroy                           104
#define OP_BitOr                               83   /* same as TK_BITOR    */
#define OP_Next                               105
#define OP_Count                              106
#define OP_IdxInsert                          107
#define OP_Lt                                  79   /* same as TK_LT       */
#define OP_FkIfZero                           108
#define OP_SeekGe                             109
#define OP_Insert                             110
#define OP_Destroy                            111
#define OP_ReadCookie                         112
#define OP_RowSetTest                         113
#define OP_LoadAnalysis                       114
#define OP_Explain                            115
#define OP_HaltIfNull                         116
#define OP_OpenPseudo                         117
#define OP_OpenEphemeral                      118
#define OP_Null                               119
#define OP_Move                               120
#define OP_Blob                               121
#define OP_Add                                 86   /* same as TK_PLUS     */
#define OP_Rewind                             122
#define OP_SeekGt                             123
#define OP_VBegin                             124
#define OP_VUpdate                            125
#define OP_IfZero                             126
#define OP_BitNot                              93   /* same as TK_BITNOT   */
#define OP_VCreate                            127
#define OP_Found                              128
#define OP_IfPos                              129
#define OP_NullRow                            131
#define OP_Jump                               132
#define OP_Permutation                        133

/* The following opcode values are never used */
#define OP_NotUsed_134                        134
#define OP_NotUsed_135                        135
#define OP_NotUsed_136                        136
#define OP_NotUsed_137                        137
#define OP_NotUsed_138                        138
#define OP_NotUsed_139                        139
#define OP_NotUsed_140                        140

................................................................................
#define OPFLG_JUMP            0x0001  /* jump:  P2 holds jmp target */
#define OPFLG_OUT2_PRERELEASE 0x0002  /* out2-prerelease: */
#define OPFLG_IN1             0x0004  /* in1:   P1 is an input */
#define OPFLG_IN2             0x0008  /* in2:   P2 is an input */
#define OPFLG_IN3             0x0010  /* in3:   P3 is an input */
#define OPFLG_OUT3            0x0020  /* out3:  P3 is an output */
#define OPFLG_INITIALIZER {\
/*   0 */ 0x00, 0x01, 0x00, 0x00, 0x10, 0x08, 0x02, 0x00,\
/*   8 */ 0x00, 0x04, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,\
/*  16 */ 0x02, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x05,\
/*  24 */ 0x00, 0x01, 0x04, 0x02, 0x00, 0x00, 0x02, 0x04,\
/*  32 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x11, 0x02,\
/*  40 */ 0x05, 0x00, 0x02, 0x11, 0x04, 0x00, 0x08, 0x11,\
/*  48 */ 0x01, 0x02, 0x01, 0x21, 0x08, 0x00, 0x02, 0x01,\
/*  56 */ 0x11, 0x01, 0x02, 0x00, 0x04, 0x00, 0x00, 0x02,\
/*  64 */ 0x11, 0x00, 0x00, 0x05, 0x2c, 0x2c, 0x00, 0x11,\
/*  72 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
/*  80 */ 0x15, 0x00, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,\
/*  88 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x00, 0x04, 0x02, 0x00,\
/*  96 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\
/* 104 */ 0x00, 0x01, 0x02, 0x08, 0x01, 0x11, 0x00, 0x02,\
/* 112 */ 0x02, 0x15, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02,\
/* 120 */ 0x00, 0x02, 0x01, 0x11, 0x00, 0x00, 0x05, 0x00,\
/* 128 */ 0x11, 0x05, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,\
/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
/* 144 */ 0x04, 0x04,}

/************** End of opcodes.h *********************************************/
/************** Continuing where we left off in vdbe.h ***********************/

/*
................................................................................
SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);
SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);
SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
SQLITE_PRIVATE void sqlite3VdbeProgramDelete(sqlite3 *, SubProgram *, int);



#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
SQLITE_PRIVATE int sqlite3VdbeReleaseMemory(int);
#endif
SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int);
SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);


#ifndef NDEBUG
SQLITE_PRIVATE   void sqlite3VdbeComment(Vdbe*, const char*, ...);
................................................................................
  ** space is allocated for the fields below this point. An attempt to
  ** access them will result in a segfault or malfunction.
  *********************************************************************/

  int iTable;            /* TK_COLUMN: cursor number of table holding column
                         ** TK_REGISTER: register number
                         ** TK_TRIGGER: 1 -> new, 0 -> old */
  i16 iColumn;           /* TK_COLUMN: column index.  -1 for rowid */

  i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
  i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
  u8 flags2;             /* Second set of flags.  EP2_... */
  u8 op2;                /* If a TK_REGISTER, the original value of Expr.op */
  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
  Table *pTab;           /* Table for TK_COLUMN expressions. */
#if SQLITE_MAX_EXPR_DEPTH>0
................................................................................
  /* Above is constant between recursions.  Below is reset before and after
  ** each recursion */

  int nVar;            /* Number of '?' variables seen in the SQL so far */
  int nVarExpr;        /* Number of used slots in apVarExpr[] */
  int nVarExprAlloc;   /* Number of allocated slots in apVarExpr[] */
  Expr **apVarExpr;    /* Pointers to :aaa and $aaaa wildcard expressions */

  int nAlias;          /* Number of aliased result set columns */
  int nAliasAlloc;     /* Number of allocated slots for aAlias[] */
  int *aAlias;         /* Register used to hold aliased result */
  u8 explain;          /* True if the EXPLAIN flag is found on the query */
  Token sNameToken;    /* Token with unqualified schema object name */
  Token sLastToken;    /* The last token parsed */
  const char *zTail;   /* All SQL text past the last semicolon parsed */
................................................................................
SQLITE_PRIVATE void sqlite3Vacuum(Parse*);
SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*);
SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
SQLITE_PRIVATE Expr *sqlite3CreateIdExpr(Parse *, const char*);
SQLITE_PRIVATE void sqlite3PrngSaveState(void);
SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
SQLITE_PRIVATE void sqlite3PrngResetState(void);
SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*);
SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);
................................................................................
SQLITE_PRIVATE void sqlite3RootPageMoved(Db*, int, int);
SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*);
SQLITE_PRIVATE void sqlite3AlterFunctions(sqlite3*);
SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*);
SQLITE_PRIVATE void sqlite3CodeSubselect(Parse *, Expr *, int, int);
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
................................................................................
SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);

SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);
SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);
SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);
SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);


SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);

/*
** The interface to the LEMON-generated parser
*/
................................................................................
** Attempt to release up to n bytes of non-essential memory currently
** held by SQLite. An example of non-essential memory is memory used to
** cache database pages that are not currently in use.
*/
SQLITE_API int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  int nRet = 0;
#if 0
  nRet += sqlite3VdbeReleaseMemory(n);
#endif
  nRet += sqlite3PcacheReleaseMemory(n-nRet);
  return nRet;
#else
  UNUSED_PARAMETER(n);
  return SQLITE_OK;
#endif
}
................................................................................
  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */
  int iStatement;         /* Statement number (or 0 if has not opened stmt) */
#ifdef SQLITE_DEBUG
  FILE *trace;            /* Write an execution trace here, if not NULL */
#endif
  VdbeFrame *pFrame;      /* Parent frame */
  int nFrame;             /* Number of frames in pFrame list */

};

/*
** The following are allowed values for Vdbe.magic
*/
#define VDBE_MAGIC_INIT     0x26bceaa5    /* Building a VDBE program */
#define VDBE_MAGIC_RUN      0xbdf20da3    /* VDBE is ready to execute */
................................................................................
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int, int);
SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*);
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
SQLITE_PRIVATE int sqlite3VdbeReleaseBuffers(Vdbe *p);
#endif

#ifndef SQLITE_OMIT_FOREIGN_KEY
SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
#else
# define sqlite3VdbeCheckFk(p,i) 0
#endif

................................................................................
    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \
    *zOut++ = (u8)(c&0x00FF);                                       \
  }                                                                 \
}

#define READ_UTF16LE(zIn, c){                                         \
  c = (*zIn++);                                                       \
  c += ((*zIn++)<<8);                                                 \
  if( c>=0xD800 && c<0xE000 ){                                        \
    int c2 = (*zIn++);                                                \
    c2 += ((*zIn++)<<8);                                              \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

#define READ_UTF16BE(zIn, c){                                         \
  c = ((*zIn++)<<8);                                                  \
  c += (*zIn++);                                                      \
  if( c>=0xD800 && c<0xE000 ){                                        \
    int c2 = ((*zIn++)<<8);                                           \
    c2 += (*zIn++);                                                   \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

/*
................................................................................
    pMem->n = (int)(z - zOut);
    *z++ = 0;
  }else{
    assert( desiredEnc==SQLITE_UTF8 );
    if( pMem->enc==SQLITE_UTF16LE ){
      /* UTF-16 Little-endian -> UTF-8 */
      while( zIn<zTerm ){
        READ_UTF16LE(zIn, c); 
        WRITE_UTF8(z, c);
      }
    }else{
      /* UTF-16 Big-endian -> UTF-8 */
      while( zIn<zTerm ){
        READ_UTF16BE(zIn, c); 
        WRITE_UTF8(z, c);
      }
    }
    pMem->n = (int)(z - zOut);
  }
  *z = 0;
  assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
................................................................................
  assert( m.z==m.zMalloc );
  *pnOut = m.n;
  return m.z;
}
#endif

/*
** pZ is a UTF-16 encoded unicode string at least nChar characters long.
** Return the number of bytes in the first nChar unicode characters
** in pZ.  nChar must be non-negative.
*/
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  int c;
  unsigned char const *z = zIn;
  int n = 0;

  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
    /* Using an "if (SQLITE_UTF16NATIVE==SQLITE_UTF16BE)" construct here
    ** and in other parts of this file means that at one branch will
    ** not be covered by coverage testing on any single host. But coverage
    ** will be complete if the tests are run on both a little-endian and 
    ** big-endian host. Because both the UTF16NATIVE and SQLITE_UTF16BE
    ** macros are constant at compile time the compiler can determine
    ** which branch will be followed. It is therefore assumed that no runtime
    ** penalty is paid for this "if" statement.
    */
    while( n<nChar ){
      READ_UTF16BE(z, c);
      n++;
    }
  }else{
    while( n<nChar ){
      READ_UTF16LE(z, c);
      n++;
    }
  }
  return (int)(z-(unsigned char const *)zIn);
}

#if defined(SQLITE_TEST)
................................................................................
    if( i>=0xD800 && i<0xE000 ) continue;
    z = zBuf;
    WRITE_UTF16LE(z, i);
    n = (int)(z-zBuf);
    assert( n>0 && n<=4 );
    z[0] = 0;
    z = zBuf;
    READ_UTF16LE(z, c);
    assert( c==i );
    assert( (z-zBuf)==n );
  }
  for(i=0; i<0x00110000; i++){
    if( i>=0xD800 && i<0xE000 ) continue;
    z = zBuf;
    WRITE_UTF16BE(z, i);
    n = (int)(z-zBuf);
    assert( n>0 && n<=4 );
    z[0] = 0;
    z = zBuf;
    READ_UTF16BE(z, c);
    assert( c==i );
    assert( (z-zBuf)==n );
  }
}
#endif /* SQLITE_TEST */
#endif /* SQLITE_OMIT_UTF16 */

................................................................................
/************** End of hash.c ************************************************/
/************** Begin file opcodes.c *****************************************/
/* Automatically generated.  Do not edit */
/* See the mkopcodec.awk script for details. */
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
 static const char *const azName[] = { "?",
     /*   1 */ "VNext",
     /*   2 */ "Affinity",
     /*   3 */ "Column",
     /*   4 */ "SetCookie",
     /*   5 */ "Seek",
     /*   6 */ "Sequence",
     /*   7 */ "Savepoint",
     /*   8 */ "RowKey",
     /*   9 */ "SCopy",
     /*  10 */ "OpenWrite",
     /*  11 */ "If",
     /*  12 */ "CollSeq",
     /*  13 */ "OpenRead",
     /*  14 */ "Expire",
     /*  15 */ "AutoCommit",
     /*  16 */ "Pagecount",
     /*  17 */ "IntegrityCk",
     /*  18 */ "Sort",
     /*  19 */ "Not",
     /*  20 */ "Copy",
     /*  21 */ "Trace",
     /*  22 */ "Function",
     /*  23 */ "IfNeg",
     /*  24 */ "Noop",
     /*  25 */ "Program",
     /*  26 */ "Return",
     /*  27 */ "NewRowid",
     /*  28 */ "FkCounter",
     /*  29 */ "Variable",
     /*  30 */ "String",
     /*  31 */ "RealAffinity",
     /*  32 */ "VRename",
     /*  33 */ "ParseSchema",
     /*  34 */ "VOpen",
     /*  35 */ "Close",
     /*  36 */ "CreateIndex",
     /*  37 */ "IsUnique",
     /*  38 */ "NotFound",
     /*  39 */ "Int64",
     /*  40 */ "MustBeInt",
     /*  41 */ "Halt",
     /*  42 */ "Rowid",
     /*  43 */ "IdxLT",
     /*  44 */ "AddImm",
     /*  45 */ "RowData",
     /*  46 */ "MemMax",
     /*  47 */ "NotExists",
     /*  48 */ "Gosub",
     /*  49 */ "Integer",
     /*  50 */ "Prev",
     /*  51 */ "RowSetRead",
     /*  52 */ "RowSetAdd",
     /*  53 */ "VColumn",
     /*  54 */ "CreateTable",
     /*  55 */ "Last",
     /*  56 */ "SeekLe",
     /*  57 */ "IncrVacuum",
     /*  58 */ "IdxRowid",
     /*  59 */ "ResetCount",
     /*  60 */ "Yield",
     /*  61 */ "DropTrigger",
     /*  62 */ "DropIndex",
     /*  63 */ "Param",
     /*  64 */ "IdxGE",
     /*  65 */ "IdxDelete",
     /*  66 */ "Vacuum",
     /*  67 */ "IfNot",
     /*  68 */ "Or",
     /*  69 */ "And",
     /*  70 */ "DropTable",
     /*  71 */ "SeekLt",
     /*  72 */ "MakeRecord",
     /*  73 */ "IsNull",
     /*  74 */ "NotNull",
     /*  75 */ "Ne",
     /*  76 */ "Eq",
     /*  77 */ "Gt",
     /*  78 */ "Le",
     /*  79 */ "Lt",
     /*  80 */ "Ge",
     /*  81 */ "ResultRow",
     /*  82 */ "BitAnd",
     /*  83 */ "BitOr",
     /*  84 */ "ShiftLeft",
     /*  85 */ "ShiftRight",
     /*  86 */ "Add",
     /*  87 */ "Subtract",
     /*  88 */ "Multiply",
     /*  89 */ "Divide",
     /*  90 */ "Remainder",
     /*  91 */ "Concat",
     /*  92 */ "Delete",
     /*  93 */ "BitNot",
     /*  94 */ "String8",
     /*  95 */ "AggFinal",
     /*  96 */ "Compare",
     /*  97 */ "Goto",
     /*  98 */ "TableLock",
     /*  99 */ "Clear",
     /* 100 */ "VerifyCookie",
     /* 101 */ "AggStep",
     /* 102 */ "Transaction",
     /* 103 */ "VFilter",
     /* 104 */ "VDestroy",
     /* 105 */ "Next",
     /* 106 */ "Count",
     /* 107 */ "IdxInsert",
     /* 108 */ "FkIfZero",
     /* 109 */ "SeekGe",
     /* 110 */ "Insert",
     /* 111 */ "Destroy",
     /* 112 */ "ReadCookie",
     /* 113 */ "RowSetTest",
     /* 114 */ "LoadAnalysis",
     /* 115 */ "Explain",
     /* 116 */ "HaltIfNull",
     /* 117 */ "OpenPseudo",
     /* 118 */ "OpenEphemeral",
     /* 119 */ "Null",
     /* 120 */ "Move",
     /* 121 */ "Blob",
     /* 122 */ "Rewind",
     /* 123 */ "SeekGt",
     /* 124 */ "VBegin",
     /* 125 */ "VUpdate",
     /* 126 */ "IfZero",
     /* 127 */ "VCreate",
     /* 128 */ "Found",
     /* 129 */ "IfPos",
     /* 130 */ "Real",
     /* 131 */ "NullRow",
     /* 132 */ "Jump",
     /* 133 */ "Permutation",
     /* 134 */ "NotUsed_134",
     /* 135 */ "NotUsed_135",
     /* 136 */ "NotUsed_136",
     /* 137 */ "NotUsed_137",
     /* 138 */ "NotUsed_138",
     /* 139 */ "NotUsed_139",
     /* 140 */ "NotUsed_140",
     /* 141 */ "ToText",
................................................................................
    }
  }
  
  /* If control gets to this point, then actually go ahead and make
  ** operating system calls for the specified lock.
  */
  if( locktype==SHARED_LOCK ){
    int lk, lrc1, lrc2, lrc1Errno;

    
    /* Now get the read-lock SHARED_LOCK */
    /* note that the quality of the randomness doesn't matter that much */
    lk = random(); 
    context->sharedByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
    lrc1 = afpSetLock(context->dbPath, pFile, 
          SHARED_FIRST+context->sharedByte, 1, 1);
................................................................................

/*
** Determine if we are dealing with WindowsCE - which has a much
** reduced API.
*/
#if SQLITE_OS_WINCE
# define AreFileApisANSI() 1
# define GetDiskFreeSpaceW() 0
#endif

/*
** WinCE lacks native support for file locking so we have to fake it
** with some code of our own.
*/
#if SQLITE_OS_WINCE
................................................................................

/*
** The return value of getLastErrorMsg
** is zero if the error message fits in the buffer, or non-zero
** otherwise (if the message was truncated).
*/
static int getLastErrorMsg(int nBuf, char *zBuf){
  DWORD error = GetLastError();

#if SQLITE_OS_WINCE
  sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);
#else
  /* FormatMessage returns 0 on failure.  Otherwise it
  ** returns the number of TCHARs written to the output
  ** buffer, excluding the terminating null char.
  */


























  if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
                      NULL,
                      error,
                      0,
                      zBuf,
                      nBuf-1,


                      0))
  {
    sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);





  }
#endif









  return 0;
}

/*
** Open a file.
*/
static int winOpen(
................................................................................
        dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,
                                  &dwDummy,
                                  &bytesPerSector,
                                  &dwDummy,
                                  &dwDummy);
      }else{
        /* trim path to just drive reference */
        CHAR *p = (CHAR *)zConverted;
        for(;*p;p++){
          if( *p == '\\' ){
            *p = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceA((CHAR*)zConverted,
                                  &dwDummy,
                                  &bytesPerSector,
                                  &dwDummy,
                                  &dwDummy);
      }
      free(zConverted);
    }
................................................................................
** page has a small header which contains the Ptr(N) pointer and other
** information such as the size of key and data.
**
** FORMAT DETAILS
**
** The file is divided into pages.  The first page is called page 1,
** the second is page 2, and so forth.  A page number of zero indicates
** "no such page".  The page size can be anything between 512 and 65536.
** Each page can be either a btree page, a freelist page or an overflow
** page.
**
** The first page is always a btree page.  The first 100 bytes of the first
** page contain a special header (the "file header") that describes the file.
** The format of the file header is as follows:
**
**   OFFSET   SIZE    DESCRIPTION
**      0      16     Header string: "SQLite format 3\000"
................................................................................
** A database connection contains a pointer to an instance of
** this object for every database file that it has open.  This structure
** is opaque to the database connection.  The database connection cannot
** see the internals of this structure and only deals with pointers to
** this structure.
**
** For some database files, the same underlying database cache might be 
** shared between multiple connections.  In that case, each contection
** has it own pointer to this object.  But each instance of this object
** points to the same BtShared object.  The database cache and the
** schema associated with the database file are all contained within
** the BtShared object.
**
** All fields in this structure are accessed under sqlite3.mutex.
** The pBt pointer itself may not be changed while there exists cursors 
** in the referenced BtShared that point back to this Btree since those
................................................................................
/*
** A cursor is a pointer to a particular entry within a particular
** b-tree within a database file.
**
** The entry is identified by its MemPage and the index in
** MemPage.aCell[] of the entry.
**
** When a single database file can shared by two more database connections,
** but cursors cannot be shared.  Each cursor is associated with a
** particular database connection identified BtCursor.pBtree.db.
**
** Fields in this structure are accessed under the BtShared.mutex
** found at self->pBt->mutex. 
*/
struct BtCursor {
................................................................................
  #define hasReadConflicts(a, b) 0
#endif

#ifndef SQLITE_OMIT_SHARED_CACHE

#ifdef SQLITE_DEBUG
/*
** This function is only used as part of an assert() statement. It checks

** that connection p holds the required locks to read or write to the 
** b-tree with root page iRoot. If so, true is returned. Otherwise, false. 


** For example, when writing to a table b-tree with root-page iRoot via 
** Btree connection pBtree:
**
**    assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );
**
** When writing to an index b-tree that resides in a sharable database, the 
** caller should have first obtained a lock specifying the root page of
** the corresponding table b-tree. This makes things a bit more complicated,
** as this module treats each b-tree as a separate structure. To determine
** the table b-tree corresponding to the index b-tree being written, this
** function has to search through the database schema.
**
** Instead of a lock on the b-tree rooted at page iRoot, the caller may
** hold a write-lock on the schema table (root page 1). This is also
** acceptable.
*/
static int hasSharedCacheTableLock(
  Btree *pBtree,         /* Handle that must hold lock */
  Pgno iRoot,            /* Root page of b-tree */
  int isIndex,           /* True if iRoot is the root of an index b-tree */
  int eLockType          /* Required lock type (READ_LOCK or WRITE_LOCK) */
){
  Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
  Pgno iTab = 0;
  BtLock *pLock;

  /* If this b-tree database is not shareable, or if the client is reading
  ** and has the read-uncommitted flag set, then no lock is required. 
  ** In these cases return true immediately.  If the client is reading 
  ** or writing an index b-tree, but the schema is not loaded, then return
  ** true also. In this case the lock is required, but it is too difficult
  ** to check if the client actually holds it. This doesn't happen very
  ** often.  */
  if( (pBtree->sharable==0)
   || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))
   || (isIndex && (!pSchema || (pSchema->flags&DB_SchemaLoaded)==0 ))
  ){
    return 1;
  }










  /* Figure out the root-page that the lock should be held on. For table
  ** b-trees, this is just the root page of the b-tree being read or
  ** written. For index b-trees, it is the root page of the associated
  ** table.  */
  if( isIndex ){
    HashElem *p;
................................................................................
      return 1;
    }
  }

  /* Failed to find the required lock. */
  return 0;
}



/*
** This function is also used as part of assert() statements only. It 
** returns true if there exist one or more cursors open on the table 
** with root page iRoot that do not belong to either connection pBtree 








** or some other connection that has the read-uncommitted flag set.

**
** For example, before writing to page iRoot:

**
**    assert( !hasReadConflicts(pBtree, iRoot) );
*/
static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
  BtCursor *p;
  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
    if( p->pgnoRoot==iRoot 
................................................................................
    }
  }
  return 0;
}
#endif    /* #ifdef SQLITE_DEBUG */

/*
** Query to see if btree handle p may obtain a lock of type eLock 
** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return
** SQLITE_OK if the lock may be obtained (by calling
** setSharedCacheTableLock()), or SQLITE_LOCKED if not.
*/
static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
  BtShared *pBt = p->pBt;
  BtLock *pIter;
................................................................................
  /* If requesting a write-lock, then the Btree must have an open write
  ** transaction on this file. And, obviously, for this to be so there 
  ** must be an open write transaction on the file itself.
  */
  assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
  assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );
  
  /* This is a no-op if the shared-cache is not enabled */
  if( !p->sharable ){
    return SQLITE_OK;
  }

  /* If some other connection is holding an exclusive lock, the
  ** requested lock may not be obtained.
  */
................................................................................
/*
** Add a lock on the table with root-page iTable to the shared-btree used
** by Btree handle p. Parameter eLock must be either READ_LOCK or 
** WRITE_LOCK.
**
** This function assumes the following:
**
**   (a) The specified b-tree connection handle is connected to a sharable
**       b-tree database (one with the BtShared.sharable) flag set, and
**
**   (b) No other b-tree connection handle holds a lock that conflicts
**       with the requested lock (i.e. querySharedCacheTableLock() has
**       already been called and returned SQLITE_OK).
**
** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM 
** is returned if a malloc attempt fails.
*/
static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
................................................................................
  return SQLITE_OK;
}
#endif /* !SQLITE_OMIT_SHARED_CACHE */

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Release all the table locks (locks obtained via calls to
** the setSharedCacheTableLock() procedure) held by Btree handle p.
**
** This function assumes that handle p has an open read or write 
** transaction. If it does not, then the BtShared.isPending variable
** may be incorrectly cleared.
*/
static void clearAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  BtLock **ppIter = &pBt->pLock;

................................................................................

  assert( pBt->isPending==0 || pBt->pWriter );
  if( pBt->pWriter==p ){
    pBt->pWriter = 0;
    pBt->isExclusive = 0;
    pBt->isPending = 0;
  }else if( pBt->nTransaction==2 ){
    /* This function is called when connection p is concluding its 
    ** transaction. If there currently exists a writer, and p is not
    ** that writer, then the number of locks held by connections other
    ** than the writer must be about to drop to zero. In this case
    ** set the isPending flag to 0.
    **
    ** If there is not currently a writer, then BtShared.isPending must
    ** be zero already. So this next line is harmless in that case.
    */
    pBt->isPending = 0;
  }
}

/*
** This function changes all write-locks held by connection p to read-locks.
*/
static void downgradeAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  if( pBt->pWriter==p ){
    BtLock *pLock;
    pBt->pWriter = 0;
    pBt->isExclusive = 0;
................................................................................
}

#endif /* SQLITE_OMIT_SHARED_CACHE */

static void releasePage(MemPage *pPage);  /* Forward reference */

/*


** Verify that the cursor holds a mutex on the BtShared
*/
#ifndef NDEBUG

static int cursorHoldsMutex(BtCursor *p){
  return sqlite3_mutex_held(p->pBt->mutex);
}
#endif


#ifndef SQLITE_OMIT_INCRBLOB
................................................................................
  for(p=pBt->pCursor; p; p=p->pNext){
    invalidateOverflowCache(p);
  }
}

/*
** This function is called before modifying the contents of a table
** b-tree to invalidate any incrblob cursors that are open on the
** row or one of the rows being modified.
**
** If argument isClearTable is true, then the entire contents of the
** table is about to be deleted. In this case invalidate all incrblob
** cursors open on any row within the table with root-page pgnoRoot.
**
** Otherwise, if argument isClearTable is false, then the row with
** rowid iRow is being replaced or deleted. In this case invalidate
** only those incrblob cursors open on this specific row.
*/
static void invalidateIncrblobCursors(
  Btree *pBtree,          /* The database file to check */
  i64 iRow,               /* The rowid that might be changing */
  int isClearTable        /* True if all rows are being deleted */
){
  BtCursor *p;
................................................................................
    if( p->isIncrblobHandle && (isClearTable || p->info.nKey==iRow) ){
      p->eState = CURSOR_INVALID;
    }
  }
}

#else

  #define invalidateOverflowCache(x)
  #define invalidateAllOverflowCache(x)
  #define invalidateIncrblobCursors(x,y,z)
#endif

/*
** Set bit pgno of the BtShared.pHasContent bitvec. This is called 
** when a page that previously contained data becomes a free-list leaf 
** page.
**
** The BtShared.pHasContent bitvec exists to work around an obscure
................................................................................
** is extracted from the free-list and reused, then the original data
** may be lost. In the event of a rollback, it may not be possible
** to restore the database to its original configuration.
**
** The solution is the BtShared.pHasContent bitvec. Whenever a page is 
** moved to become a free-list leaf page, the corresponding bit is
** set in the bitvec. Whenever a leaf page is extracted from the free-list,
** optimization 2 above is ommitted if the corresponding bit is already
** set in BtShared.pHasContent. The contents of the bitvec are cleared
** at the end of every transaction.
*/
static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
  int rc = SQLITE_OK;
  if( !pBt->pHasContent ){
    int nPage = 100;
................................................................................
  }

  invalidateOverflowCache(pCur);
  return rc;
}

/*
** Save the positions of all cursors except pExcept open on the table 
** with root-page iRoot. Usually, this is called just before cursor
** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()).
*/
static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pExcept==0 || pExcept->pBt==pBt );
  for(p=pBt->pCursor; p; p=p->pNext){
................................................................................
  if( nSize<4 ){
    nSize = 4;
  }

  assert( nSize==debuginfo.nSize );
  return (u16)nSize;
}
#ifndef NDEBUG




static u16 cellSize(MemPage *pPage, int iCell){
  return cellSizePtr(pPage, findCell(pPage, iCell));
}
#endif

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
................................................................................

/*
** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
** at the conclusion of a transaction.
*/
static void btreeEndTransaction(Btree *p){
  BtShared *pBt = p->pBt;
  BtCursor *pCsr;
  assert( sqlite3BtreeHoldsMutex(p) );

  /* Search for a cursor held open by this b-tree connection. If one exists,
  ** then the transaction will be downgraded to a read-only transaction
  ** instead of actually concluded. A subsequent call to CommitPhaseTwo() 
  ** or Rollback() will finish the transaction and unlock the database.  */
  for(pCsr=pBt->pCursor; pCsr && pCsr->pBtree!=p; pCsr=pCsr->pNext);
  assert( pCsr==0 || p->inTrans>TRANS_NONE );

  btreeClearHasContent(pBt);
  if( pCsr ){




    downgradeAllSharedCacheTableLocks(p);
    p->inTrans = TRANS_READ;
  }else{
    /* If the handle had any kind of transaction open, decrement the 
    ** transaction count of the shared btree. If the transaction count 
    ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()
    ** call below will unlock the pager.  */
................................................................................
  const void *pData, int nData,  /* The data of the new record */
  int nZero,                     /* Number of extra 0 bytes to append to data */
  int appendBias,                /* True if this is likely an append */
  int seekResult                 /* Result of prior MovetoUnpacked() call */
){
  int rc;
  int loc = seekResult;          /* -1: before desired location  +1: after */
  int szNew;
  int idx;
  MemPage *pPage;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;
  unsigned char *oldCell;
  unsigned char *newCell = 0;

................................................................................
    nVal = sqlite3Strlen30(zVal)-1;
    assert( zVal[nVal]=='\'' );
    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
                         0, SQLITE_DYNAMIC);
  }
#endif




  *ppVal = pVal;
  return SQLITE_OK;

no_mem:
  db->mallocFailed = 1;
  sqlite3DbFree(db, zVal);
  sqlite3ValueFree(pVal);
................................................................................
  return p;
}

/*
** Remember the SQL string for a prepared statement.
*/
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){

  if( p==0 ) return;
#ifdef SQLITE_OMIT_TRACE
  if( !isPrepareV2 ) return;
#endif
  assert( p->zSql==0 );
  p->zSql = sqlite3DbStrNDup(p->db, z, n);
  p->isPrepareV2 = isPrepareV2 ? 1 : 0;
}

/*
** Return the SQL associated with a prepared statement
*/
SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe *)pStmt;
................................................................................
  for(i=0; i<p->nChildCsr; i++){
    sqlite3VdbeFreeCursor(p->v, apCsr[i]);
  }
  releaseMemArray(aMem, p->nChildMem);
  sqlite3DbFree(p->v->db, p);
}


#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
SQLITE_PRIVATE int sqlite3VdbeReleaseBuffers(Vdbe *p){
  int ii;
  int nFree = 0;
  assert( sqlite3_mutex_held(p->db->mutex) );
  for(ii=1; ii<=p->nMem; ii++){
    Mem *pMem = &p->aMem[ii];
    if( pMem->flags & MEM_RowSet ){
      sqlite3RowSetClear(pMem->u.pRowSet);
    }
    if( pMem->z && pMem->flags&MEM_Dyn ){
      assert( !pMem->xDel );
      nFree += sqlite3DbMallocSize(pMem->db, pMem->z);
      sqlite3VdbeMemRelease(pMem);
    }
  }
  return nFree;
}
#endif

#ifndef SQLITE_OMIT_EXPLAIN
/*
** Give a listing of the program in the virtual machine.
**
** The interface is the same as sqlite3VdbeExec().  But instead of
** running the code, it invokes the callback once for each instruction.
** This feature is used to implement "EXPLAIN".
................................................................................

/*
** Return the database associated with the Vdbe.
*/
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
  return v->db;
}








































/************** End of vdbeaux.c *********************************************/
/************** Begin file vdbeapi.c *****************************************/
/*
** 2004 May 26
**
** The author disclaims copyright to this source code.  In place of
................................................................................
#if SQLITE_THREADSAFE
  sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
#endif
  sqlite3_mutex_enter(mutex);
  for(i=0; i<p->nVar; i++){
    sqlite3VdbeMemRelease(&p->aVar[i]);
    p->aVar[i].flags = MEM_Null;



  }
  sqlite3_mutex_leave(mutex);
  return rc;
}


/**************************** sqlite3_value_  *******************************
................................................................................
  /* Assert that malloc() has not failed */
  db = p->db;
  if( db->mallocFailed ){
    return SQLITE_NOMEM;
  }

  if( p->pc<=0 && p->expired ){
    if( ALWAYS(p->rc==SQLITE_OK) ){
      p->rc = SQLITE_SCHEMA;
    }
    rc = SQLITE_ERROR;
    goto end_of_step;
  }
  if( sqlite3SafetyOn(db) ){
    p->rc = SQLITE_MISUSE;
................................................................................
    return SQLITE_RANGE;
  }
  i--;
  pVar = &p->aVar[i];
  sqlite3VdbeMemRelease(pVar);
  pVar->flags = MEM_Null;
  sqlite3Error(p->db, SQLITE_OK, 0);









  return SQLITE_OK;
}

/*
** Bind a text or BLOB value.
*/
static int bindText(
................................................................................
** SQLITE_OK is returned.
*/
SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
  Vdbe *pFrom = (Vdbe*)pFromStmt;
  Vdbe *pTo = (Vdbe*)pToStmt;
  if( pFrom->nVar!=pTo->nVar ){
    return SQLITE_ERROR;






  }
  return sqlite3TransferBindings(pFromStmt, pToStmt);
}
#endif

/*
** Return the sqlite3* database handle to which the prepared statement given
................................................................................
** P if required.
*/
#define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)

/*
** Argument pMem points at a register that will be passed to a
** user-defined function or returned to the user as the result of a query.
** The second argument, 'db_enc' is the text encoding used by the vdbe for
** register variables.  This routine sets the pMem->enc and pMem->type
** variables used by the sqlite3_value_*() routines.
*/
#define storeTypeInfo(A,B) _storeTypeInfo(A)
static void _storeTypeInfo(Mem *pMem){
  int flags = pMem->flags;
  if( flags & MEM_Null ){
    pMem->type = SQLITE_NULL;
  }
  else if( flags & MEM_Int ){
    pMem->type = SQLITE_INTEGER;
  }
................................................................................
** loss of information and return the revised type of the argument.
**
** This is an EXPERIMENTAL api and is subject to change or removal.
*/
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
  Mem *pMem = (Mem*)pVal;
  applyNumericAffinity(pMem);
  storeTypeInfo(pMem, 0);
  return pMem->type;
}

/*
** Exported version of applyAffinity(). This one works on sqlite3_value*, 
** not the internal Mem* type.
*/
................................................................................
      i64 v;                 /* The new rowid */
      VdbeCursor *pC;        /* Cursor of table to get the new rowid */
      int res;               /* Result of an sqlite3BtreeLast() */
      int cnt;               /* Counter to limit the number of searches */
      Mem *pMem;             /* Register holding largest rowid for AUTOINCREMENT */
      VdbeFrame *pFrame;     /* Root frame of VDBE */
    } be;
    struct OP_Insert_stack_vars {
      Mem *pData;       /* MEM cell holding data for the record to be inserted */
      Mem *pKey;        /* MEM cell holding key  for the record */
      i64 iKey;         /* The integer ROWID or key for the record to be inserted */
      VdbeCursor *pC;   /* Cursor to table into which insert is written */
      int nZero;        /* Number of zero-bytes to append */
      int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
      const char *zDb;  /* database name - used by the update hook */
................................................................................
#endif /* local variables moved into u.ab */

  u.ab.p1 = pOp->p1 - 1;
  u.ab.p2 = pOp->p2;
  u.ab.n = pOp->p3;
  assert( u.ab.p1>=0 && u.ab.p1+u.ab.n<=p->nVar );
  assert( u.ab.p2>=1 && u.ab.p2+u.ab.n-1<=p->nMem );
  assert( pOp->p4.z==0 || pOp->p3==1 );

  while( u.ab.n-- > 0 ){
    u.ab.pVar = &p->aVar[u.ab.p1++];
    if( sqlite3VdbeMemTooBig(u.ab.pVar) ){
      goto too_big;
    }
    pOut = &p->aMem[u.ab.p2++];
................................................................................
  /* Make sure the results of the current row are \000 terminated
  ** and have an assigned type.  The results are de-ephemeralized as
  ** as side effect.
  */
  u.ad.pMem = p->pResultSet = &p->aMem[pOp->p1];
  for(u.ad.i=0; u.ad.i<pOp->p2; u.ad.i++){
    sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
    storeTypeInfo(&u.ad.pMem[u.ad.i], encoding);
    REGISTER_TRACE(pOp->p1+u.ad.i, &u.ad.pMem[u.ad.i]);
  }
  if( db->mallocFailed ) goto no_mem;

  /* Return SQLITE_ROW
  */
  p->pc = pc + 1;
................................................................................
  assert( u.ag.apVal || u.ag.n==0 );

  assert( u.ag.n==0 || (pOp->p2>0 && pOp->p2+u.ag.n<=p->nMem+1) );
  assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+u.ag.n );
  u.ag.pArg = &p->aMem[pOp->p2];
  for(u.ag.i=0; u.ag.i<u.ag.n; u.ag.i++, u.ag.pArg++){
    u.ag.apVal[u.ag.i] = u.ag.pArg;
    storeTypeInfo(u.ag.pArg, encoding);
    REGISTER_TRACE(pOp->p2, u.ag.pArg);
  }

  assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC );
  if( pOp->p4type==P4_FUNCDEF ){
    u.ag.ctx.pFunc = pOp->p4.pFunc;
    u.ag.ctx.pVdbeFunc = 0;
................................................................................
    /* Record changes in the file format */
    u.au.pDb->pSchema->file_format = (u8)pIn3->u.i;
  }
  if( pOp->p1==1 ){
    /* Invalidate all prepared statements whenever the TEMP database
    ** schema is changed.  Ticket #1644 */
    sqlite3ExpirePreparedStatements(db);

  }
  break;
}

/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
................................................................................
  int p2;
  int iDb;
  int wrFlag;
  Btree *pX;
  VdbeCursor *pCur;
  Db *pDb;
#endif /* local variables moved into u.aw */






  u.aw.nField = 0;
  u.aw.pKeyInfo = 0;
  u.aw.p2 = pOp->p2;
  u.aw.iDb = pOp->p3;
  assert( u.aw.iDb>=0 && u.aw.iDb<db->nDb );
  assert( (p->btreeMask & (1<<u.aw.iDb))!=0 );
................................................................................
** and register P2 becomes ephemeral.  If the cursor is changed, the
** value of register P2 will then change.  Make sure this does not
** cause any problems.)
**
** This instruction only works on tables.  The equivalent instruction
** for indices is OP_IdxInsert.
*/





case OP_Insert: {

#if 0  /* local variables moved into u.bf */
  Mem *pData;       /* MEM cell holding data for the record to be inserted */
  Mem *pKey;        /* MEM cell holding key  for the record */
  i64 iKey;         /* The integer ROWID or key for the record to be inserted */
  VdbeCursor *pC;   /* Cursor to table into which insert is written */
  int nZero;        /* Number of zero-bytes to append */
  int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
  const char *zDb;  /* database name - used by the update hook */
  const char *zTbl; /* Table name - used by the opdate hook */
  int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */
#endif /* local variables moved into u.bf */

  u.bf.pData = &p->aMem[pOp->p2];
  u.bf.pKey = &p->aMem[pOp->p3];
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  u.bf.pC = p->apCsr[pOp->p1];
  assert( u.bf.pC!=0 );
  assert( u.bf.pC->pCursor!=0 );
  assert( u.bf.pC->pseudoTableReg==0 );
  assert( u.bf.pKey->flags & MEM_Int );
  assert( u.bf.pC->isTable );
  REGISTER_TRACE(pOp->p2, u.bf.pData);
  REGISTER_TRACE(pOp->p3, u.bf.pKey);





  u.bf.iKey = u.bf.pKey->u.i;





  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = u.bf.pKey->u.i;
  if( u.bf.pData->flags & MEM_Null ){
    u.bf.pData->z = 0;
    u.bf.pData->n = 0;
  }else{
    assert( u.bf.pData->flags & (MEM_Blob|MEM_Str) );
  }
  u.bf.seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? u.bf.pC->seekResult : 0);
................................................................................
  u.cc.n = pOp->p5;
  assert( u.cc.n>=0 );
  u.cc.pRec = &p->aMem[pOp->p2];
  u.cc.apVal = p->apArg;
  assert( u.cc.apVal || u.cc.n==0 );
  for(u.cc.i=0; u.cc.i<u.cc.n; u.cc.i++, u.cc.pRec++){
    u.cc.apVal[u.cc.i] = u.cc.pRec;
    storeTypeInfo(u.cc.pRec, encoding);
  }
  u.cc.ctx.pFunc = pOp->p4.pFunc;
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  u.cc.ctx.pMem = u.cc.pMem = &p->aMem[pOp->p3];
  u.cc.pMem->n++;
  u.cc.ctx.s.flags = MEM_Null;
  u.cc.ctx.s.z = 0;
................................................................................

  /* Invoke the xFilter method */
  {
    u.ch.res = 0;
    u.ch.apArg = p->apArg;
    for(u.ch.i = 0; u.ch.i<u.ch.nArg; u.ch.i++){
      u.ch.apArg[u.ch.i] = &u.ch.pArgc[u.ch.i+1];
      storeTypeInfo(u.ch.apArg[u.ch.i], 0);
    }

    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    p->inVtabMethod = 1;
    rc = u.ch.pModule->xFilter(u.ch.pVtabCursor, u.ch.iQuery, pOp->p4.z, u.ch.nArg, u.ch.apArg);
    p->inVtabMethod = 0;
    sqlite3DbFree(db, p->zErrMsg);
................................................................................
  u.cl.pModule = (sqlite3_module *)u.cl.pVtab->pModule;
  u.cl.nArg = pOp->p2;
  assert( pOp->p4type==P4_VTAB );
  if( ALWAYS(u.cl.pModule->xUpdate) ){
    u.cl.apArg = p->apArg;
    u.cl.pX = &p->aMem[pOp->p3];
    for(u.cl.i=0; u.cl.i<u.cl.nArg; u.cl.i++){
      storeTypeInfo(u.cl.pX, 0);
      u.cl.apArg[u.cl.i] = u.cl.pX;
      u.cl.pX++;
    }
    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    rc = u.cl.pModule->xUpdate(u.cl.pVtab, u.cl.nArg, u.cl.apArg, &u.cl.rowid);
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = u.cl.pVtab->zErrMsg;
................................................................................
      pTopNC = pTopNC->pNext;
    }
    return WRC_Prune;
  } else {
    return WRC_Abort;
  }
}






















/*
** This routine is callback for sqlite3WalkExpr().
**
** Resolve symbolic names into TK_COLUMN operators for the current
** node in the expression tree.  Return 0 to continue the search down
** the tree or 2 to abort the tree walk.
................................................................................
  assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
  z = pExpr->u.zToken;
  assert( z!=0 );
  assert( z[0]!=0 );
  if( z[1]==0 ){
    /* Wildcard of the form "?".  Assign the next variable number */
    assert( z[0]=='?' );
    pExpr->iTable = ++pParse->nVar;
  }else if( z[0]=='?' ){
    /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
    ** use it as the variable number */
    int i;
    pExpr->iTable = i = atoi((char*)&z[1]);
    testcase( i==0 );
    testcase( i==1 );
    testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
    testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );
    if( i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
      sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
          db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
................................................................................
    int i;
    u32 n;
    n = sqlite3Strlen30(z);
    for(i=0; i<pParse->nVarExpr; i++){
      Expr *pE = pParse->apVarExpr[i];
      assert( pE!=0 );
      if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){
        pExpr->iTable = pE->iTable;
        break;
      }
    }
    if( i>=pParse->nVarExpr ){
      pExpr->iTable = ++pParse->nVar;
      if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
        pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
        pParse->apVarExpr =
            sqlite3DbReallocOrFree(
              db,
              pParse->apVarExpr,
              pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0])
................................................................................
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
  Select *p;                            /* SELECT to the right of IN operator */
  int eType = 0;                        /* Type of RHS table. IN_INDEX_* */
  int iTab = pParse->nTab++;            /* Cursor of the RHS table */
  int mustBeUnique = (prNotFound==0);   /* True if RHS must be unique */



  /* Check to see if an existing table or index can be used to
  ** satisfy the query.  This is preferable to generating a new 
  ** ephemeral table.
  */
  p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0);
  if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){
................................................................................
          }
        }
      }
    }
  }

  if( eType==0 ){
    /* Could not found an existing able or index to use as the RHS b-tree.
    ** We will have to generate an ephemeral table to do the job.
    */
    int rMayHaveNull = 0;
    eType = IN_INDEX_EPH;
    if( prNotFound ){
      *prNotFound = rMayHaveNull = ++pParse->nMem;
    }else if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){
................................................................................
** all corresponding LHS elements.  All this routine does is initialize
** the register given by rMayHaveNull to NULL.  Calling routines will take
** care of changing this register value to non-NULL if the RHS is NULL-free.
**
** If rMayHaveNull is zero, that means that the subquery is being used
** for membership testing only.  There is no need to initialize any
** registers to indicate the presense or absence of NULLs on the RHS.



*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE void sqlite3CodeSubselect(
  Parse *pParse,          /* Parsing context */
  Expr *pExpr,            /* The IN, SELECT, or EXISTS operator */
  int rMayHaveNull,       /* Register that records whether NULLs exist in RHS */
  int isRowid             /* If true, LHS of IN operator is a rowid */
){
  int testAddr = 0;                       /* One-time test address */

  Vdbe *v = sqlite3GetVdbe(pParse);
  if( NEVER(v==0) ) return;
  sqlite3ExprCachePush(pParse);

  /* This code must be run in its entirety every time it is encountered
  ** if any of the following is true:
  **
  **    *  The right-hand side is a correlated subquery
  **    *  The right-hand side is an expression list containing variables
................................................................................
        ExprList *pEList;

        assert( !isRowid );
        sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
        dest.affinity = (u8)affinity;
        assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
        if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){
          return;
        }
        pEList = pExpr->x.pSelect->pEList;
        if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ 
          keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,
              pEList->a[0].pExpr);
        }
      }else if( pExpr->x.pList!=0 ){
................................................................................

        /* Loop through each expression in <exprlist>. */
        r1 = sqlite3GetTempReg(pParse);
        r2 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
          Expr *pE2 = pItem->pExpr;


          /* If the expression is not constant then we will need to
          ** disable the test that was generated above that makes sure
          ** this code only executes once.  Because for a non-constant
          ** expression we need to rerun this code each time.
          */
          if( testAddr && !sqlite3ExprIsConstant(pE2) ){
            sqlite3VdbeChangeToNoop(v, testAddr-1, 2);
            testAddr = 0;
          }

          /* Evaluate the expression and insert it into the temp table */



          r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
          if( isRowid ){
            sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, sqlite3VdbeCurrentAddr(v)+2);

            sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
          }else{
            sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
            sqlite3ExprCacheAffinityChange(pParse, r3, 1);
            sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2);

          }
        }
        sqlite3ReleaseTempReg(pParse, r1);
        sqlite3ReleaseTempReg(pParse, r2);
      }
      if( !isRowid ){
        sqlite3VdbeChangeP4(v, addr, (void *)&keyInfo, P4_KEYINFO);
................................................................................
        dest.eDest = SRT_Exists;
        sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iParm);
        VdbeComment((v, "Init EXISTS result"));
      }
      sqlite3ExprDelete(pParse->db, pSel->pLimit);
      pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &one);
      if( sqlite3Select(pParse, pSel, &dest) ){
        return;
      }
      pExpr->iColumn = (i16)dest.iParm;
      ExprSetIrreducible(pExpr);
      break;
    }
  }

  if( testAddr ){
    sqlite3VdbeJumpHere(v, testAddr-1);
  }
  sqlite3ExprCachePop(pParse, 1);

  return;
}
#endif /* SQLITE_OMIT_SUBQUERY */

/*
** Duplicate an 8-byte value
*/
static char *dup8bytes(Vdbe *v, const char *in){
................................................................................
    case TK_VARIABLE: {
      VdbeOp *pOp;
      assert( !ExprHasProperty(pExpr, EP_IntValue) );
      assert( pExpr->u.zToken!=0 );
      assert( pExpr->u.zToken[0]!=0 );
      if( pExpr->u.zToken[1]==0
         && (pOp = sqlite3VdbeGetOp(v, -1))->opcode==OP_Variable
         && pOp->p1+pOp->p3==pExpr->iTable
         && pOp->p2+pOp->p3==target
         && pOp->p4.z==0
      ){
        /* If the previous instruction was a copy of the previous unnamed
        ** parameter into the previous register, then simply increment the
        ** repeat count on the prior instruction rather than making a new
        ** instruction.
        */
        pOp->p3++;
      }else{
        sqlite3VdbeAddOp3(v, OP_Variable, pExpr->iTable, target, 1);
        if( pExpr->u.zToken[1]!=0 ){
          sqlite3VdbeChangeP4(v, -1, pExpr->u.zToken, 0);
        }
      }
      break;
    }
    case TK_REGISTER: {
................................................................................
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_EXISTS:
    case TK_SELECT: {
      testcase( op==TK_EXISTS );
      testcase( op==TK_SELECT );
      sqlite3CodeSubselect(pParse, pExpr, 0, 0);
      inReg = pExpr->iColumn;
      break;
    }
    case TK_IN: {
      int rNotFound = 0;
      int rMayHaveNull = 0;
      int j2, j3, j4, j5;
      char affinity;
................................................................................
  ** keep the ALWAYS() in case the conditions above change with future
  ** modifications or enhancements. */
  if( ALWAYS(pExpr->op!=TK_REGISTER) ){  
    int iMem;
    iMem = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
    pExpr->iTable = iMem;

    pExpr->op = TK_REGISTER;
  }
  return inReg;
}

/*
** Return TRUE if pExpr is an constant expression that is appropriate
................................................................................
** factoring out of a loop, then evaluate the expression
** into a register and convert the expression into a TK_REGISTER
** expression.
*/
static int evalConstExpr(Walker *pWalker, Expr *pExpr){
  Parse *pParse = pWalker->pParse;
  switch( pExpr->op ){

    case TK_REGISTER: {
      return WRC_Prune;
    }
    case TK_FUNCTION:
    case TK_AGG_FUNCTION:
    case TK_CONST_FUNC: {
      /* The arguments to a function have a fixed destination.
................................................................................
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */

  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  Parse *pParse;            /* Parsing context */
  char *zErrMsg = 0;        /* Error message */
  int rc = SQLITE_OK;       /* Result code */
  int i;                    /* Loop counter */
................................................................................

  /* Allocate the parsing context */
  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
  if( pParse==0 ){
    rc = SQLITE_NOMEM;
    goto end_prepare;
  }


  if( sqlite3SafetyOn(db) ){
    rc = SQLITE_MISUSE;
    goto end_prepare;
  }
  assert( ppStmt && *ppStmt==0 );
  assert( !db->mallocFailed );
................................................................................
  return rc;
}
static int sqlite3LockAndPrepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */

  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  assert( ppStmt!=0 );
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, ppStmt, pzTail);
  if( rc==SQLITE_SCHEMA ){
    sqlite3_finalize(*ppStmt);
    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, ppStmt, pzTail);
  }
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
................................................................................
  sqlite3 *db;

  assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
  zSql = sqlite3_sql((sqlite3_stmt *)p);
  assert( zSql!=0 );  /* Reprepare only called for prepare_v2() statements */
  db = sqlite3VdbeDb(p);
  assert( sqlite3_mutex_held(db->mutex) );
  rc = sqlite3LockAndPrepare(db, zSql, -1, 0, &pNew, 0);
  if( rc ){
    if( rc==SQLITE_NOMEM ){
      db->mallocFailed = 1;
    }
    assert( pNew==0 );
    return (rc==SQLITE_LOCKED) ? SQLITE_LOCKED : SQLITE_SCHEMA;
  }else{
................................................................................
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}
SQLITE_API int sqlite3_prepare_v2(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}


#ifndef SQLITE_OMIT_UTF16
/*
................................................................................
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);
  zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
  if( zSql8 ){
    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, ppStmt, &zTail8);
  }

  if( zTail8 && pzTail ){
    /* If sqlite3_prepare returns a tail pointer, we calculate the
    ** equivalent pointer into the UTF-16 string by counting the unicode
    ** characters between zSql8 and zTail8, and then returning a pointer
    ** the same number of characters into the UTF-16 string.
................................................................................
  for(i=0; i<pTab->nCol; i++){
    if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
  }
  return -1;
}

/*
** Create an expression node for an identifier with the name of zName


*/
SQLITE_PRIVATE Expr *sqlite3CreateIdExpr(Parse *pParse, const char *zName){
  return sqlite3Expr(pParse->db, TK_ID, zName);
}


/*

** Add a term to the WHERE expression in *ppExpr that requires the
** zCol column to be equal in the two tables pTab1 and pTab2.
*/
static void addWhereTerm(
  Parse *pParse,           /* Parsing context */
  const char *zCol,        /* Name of the column */
  const Table *pTab1,      /* First table */
  const char *zAlias1,     /* Alias for first table.  May be NULL */
  const Table *pTab2,      /* Second table */
  const char *zAlias2,     /* Alias for second table.  May be NULL */
  int iRightJoinTable,     /* VDBE cursor for the right table */
  Expr **ppExpr,           /* Add the equality term to this expression */
  int isOuterJoin          /* True if dealing with an OUTER join */
){

  Expr *pE1a, *pE1b, *pE1c;
  Expr *pE2a, *pE2b, *pE2c;
  Expr *pE;


  pE1a = sqlite3CreateIdExpr(pParse, zCol);
  pE2a = sqlite3CreateIdExpr(pParse, zCol);
  if( zAlias1==0 ){
    zAlias1 = pTab1->zName;
  }
  pE1b = sqlite3CreateIdExpr(pParse, zAlias1);
  if( zAlias2==0 ){
    zAlias2 = pTab2->zName;


  }
  pE2b = sqlite3CreateIdExpr(pParse, zAlias2);
  pE1c = sqlite3PExpr(pParse, TK_DOT, pE1b, pE1a, 0);
  pE2c = sqlite3PExpr(pParse, TK_DOT, pE2b, pE2a, 0);
  pE = sqlite3PExpr(pParse, TK_EQ, pE1c, pE2c, 0);
  if( pE && isOuterJoin ){
    ExprSetProperty(pE, EP_FromJoin);
    assert( !ExprHasAnyProperty(pE, EP_TokenOnly|EP_Reduced) );
    ExprSetIrreducible(pE);
    pE->iRightJoinTable = (i16)iRightJoinTable;
  }
  *ppExpr = sqlite3ExprAnd(pParse->db,*ppExpr, pE);
}

/*
** Set the EP_FromJoin property on all terms of the given expression.
** And set the Expr.iRightJoinTable to iTable for every term in the
** expression.
**
................................................................................
      if( pRight->pOn || pRight->pUsing ){
        sqlite3ErrorMsg(pParse, "a NATURAL join may not have "
           "an ON or USING clause", 0);
        return 1;
      }
      for(j=0; j<pLeftTab->nCol; j++){
        char *zName = pLeftTab->aCol[j].zName;
        if( columnIndex(pRightTab, zName)>=0 ){

          addWhereTerm(pParse, zName, pLeftTab, pLeft->zAlias, 
                              pRightTab, pRight->zAlias,
                              pRight->iCursor, &p->pWhere, isOuter);
          
        }
      }
    }

    /* Disallow both ON and USING clauses in the same join
    */
    if( pRight->pOn && pRight->pUsing ){
................................................................................
    ** Report an error if any column mentioned in the USING clause is
    ** not contained in both tables to be joined.
    */
    if( pRight->pUsing ){
      IdList *pList = pRight->pUsing;
      for(j=0; j<pList->nId; j++){
        char *zName = pList->a[j].zName;
        if( columnIndex(pLeftTab, zName)<0 || columnIndex(pRightTab, zName)<0 ){


          sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
            "not present in both tables", zName);
          return 1;
        }
        addWhereTerm(pParse, zName, pLeftTab, pLeft->zAlias, 
                            pRightTab, pRight->zAlias,
                            pRight->iCursor, &p->pWhere, isOuter);
      }
    }
  }
  return 0;
}

/*
................................................................................
  sqlite3 *db = pParse->db; /* Database connection */
  const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
  SelectDest dest;

  /* Construct the SELECT statement that will find the new values for
  ** all updated rows. 
  */
  pEList = sqlite3ExprListAppend(pParse, 0, 
                                 sqlite3CreateIdExpr(pParse, "_rowid_"));
  if( pRowid ){
    pEList = sqlite3ExprListAppend(pParse, pEList,
                                   sqlite3ExprDup(db, pRowid, 0));
  }
  assert( pTab->iPKey<0 );
  for(i=0; i<pTab->nCol; i++){
    if( aXRef[i]>=0 ){
      pExpr = sqlite3ExprDup(db, pChanges->a[aXRef[i]].pExpr, 0);
    }else{
      pExpr = sqlite3CreateIdExpr(pParse, pTab->aCol[i].zName);
    }
    pEList = sqlite3ExprListAppend(pParse, pEList, pExpr);
  }
  pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);
  
  /* Create the ephemeral table into which the update results will
  ** be stored.
................................................................................
  */
  zSql = "ATTACH '' AS vacuum_db;";
  rc = execSql(db, zSql);
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  pDb = &db->aDb[db->nDb-1];
  assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
  pTemp = db->aDb[db->nDb-1].pBt;







  nRes = sqlite3BtreeGetReserve(pMain);

  /* A VACUUM cannot change the pagesize of an encrypted database. */
#ifdef SQLITE_HAS_CODEC
  if( db->nextPagesize ){
    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
................................................................................
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  rc = execExecSql(db, 
      "SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) "
      "  FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
  if( rc!=SQLITE_OK ) goto end_of_vacuum;

  /* Loop through the tables in the main database. For each, do
  ** an "INSERT INTO vacuum_db.xxx SELECT * FROM xxx;" to copy
  ** the contents to the temporary database.
  */
  rc = execExecSql(db, 
      "SELECT 'INSERT INTO vacuum_db.' || quote(name) "
      "|| ' SELECT * FROM ' || quote(name) || ';'"
      "FROM sqlite_master "
      "WHERE type = 'table' AND name!='sqlite_sequence' "
      "  AND rootpage>0"

  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;

  /* Copy over the sequence table
................................................................................
  rc = execExecSql(db, 
      "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' "
      "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' "
  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  rc = execExecSql(db, 
      "SELECT 'INSERT INTO vacuum_db.' || quote(name) "
      "|| ' SELECT * FROM ' || quote(name) || ';' "
      "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';"
  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;


  /* Copy the triggers, views, and virtual tables from the main database
  ** over to the temporary database.  None of these objects has any
  ** associated storage, so all we have to do is copy their entries
  ** from the SQLITE_MASTER table.
  */
  rc = execSql(db,
      "INSERT INTO vacuum_db.sqlite_master "
      "  SELECT type, name, tbl_name, rootpage, sql"
      "    FROM sqlite_master"
      "   WHERE type='view' OR type='trigger'"
      "      OR (type='table' AND rootpage=0)"
  );
  if( rc ) goto end_of_vacuum;

  /* At this point, unless the main db was completely empty, there is now a
  ** transaction open on the vacuum database, but not on the main database.
................................................................................
**
** In order for the operator to be optimizible, the RHS must be a string
** literal that does not begin with a wildcard.  
*/
static int isLikeOrGlob(
  Parse *pParse,    /* Parsing and code generating context */
  Expr *pExpr,      /* Test this expression */
  int *pnPattern,   /* Number of non-wildcard prefix characters */
  int *pisComplete, /* True if the only wildcard is % in the last character */
  int *pnoCase      /* True if uppercase is equivalent to lowercase */
){
  const char *z;             /* String on RHS of LIKE operator */
  Expr *pRight, *pLeft;      /* Right and left size of LIKE operator */
  ExprList *pList;           /* List of operands to the LIKE operator */
  int c;                     /* One character in z[] */
  int cnt;                   /* Number of non-wildcard prefix characters */
  char wc[3];                /* Wildcard characters */
  CollSeq *pColl;            /* Collating sequence for LHS */
  sqlite3 *db = pParse->db;  /* Database connection */



  if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
    return 0;
  }
#ifdef SQLITE_EBCDIC
  if( *pnoCase ) return 0;
#endif
  pList = pExpr->x.pList;
  pRight = pList->a[0].pExpr;
  if( pRight->op!=TK_STRING ){
    return 0;
  }
  pLeft = pList->a[1].pExpr;
  if( pLeft->op!=TK_COLUMN ){


    return 0;
  }

  pColl = sqlite3ExprCollSeq(pParse, pLeft);
  assert( pColl!=0 || pLeft->iColumn==-1 );
  if( pColl==0 ) return 0;

  if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) &&
      (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){







    return 0;
  }
  if( sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ) return 0;















  z = pRight->u.zToken;
  if( ALWAYS(z) ){


    cnt = 0;
    while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
      cnt++;
    }
    if( cnt!=0 && c!=0 && 255!=(u8)z[cnt-1] ){

      *pisComplete = z[cnt]==wc[0] && z[cnt+1]==0;
      *pnPattern = cnt;
      return 1;
















    }
  }






  return 0;
}
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */


#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Check to see if the given expression is of the form
................................................................................
  int idxTerm               /* Index of the term to be analyzed */
){
  WhereTerm *pTerm;                /* The term to be analyzed */
  WhereMaskSet *pMaskSet;          /* Set of table index masks */
  Expr *pExpr;                     /* The expression to be analyzed */
  Bitmask prereqLeft;              /* Prerequesites of the pExpr->pLeft */
  Bitmask prereqAll;               /* Prerequesites of pExpr */
  Bitmask extraRight = 0;
  int nPattern;
  int isComplete;
  int noCase;
  int op;                          /* Top-level operator.  pExpr->op */
  Parse *pParse = pWC->pParse;     /* Parsing context */
  sqlite3 *db = pParse->db;        /* Database connection */

  if( db->mallocFailed ){
    return;
  }
................................................................................
  ** A like pattern of the form "x LIKE 'abc%'" is changed into constraints
  **
  **          x>='abc' AND x<'abd' AND x LIKE 'abc%'
  **
  ** The last character of the prefix "abc" is incremented to form the
  ** termination condition "abd".
  */
  if( isLikeOrGlob(pParse, pExpr, &nPattern, &isComplete, &noCase)
         && pWC->op==TK_AND ){
    Expr *pLeft, *pRight;
    Expr *pStr1, *pStr2;
    Expr *pNewExpr1, *pNewExpr2;
    int idxNew1, idxNew2;

    pLeft = pExpr->x.pList->a[1].pExpr;
    pRight = pExpr->x.pList->a[0].pExpr;
    pStr1 = sqlite3Expr(db, TK_STRING, pRight->u.zToken);
    if( pStr1 ) pStr1->u.zToken[nPattern] = 0;
    pStr2 = sqlite3ExprDup(db, pStr1, 0);
    if( !db->mallocFailed ){
      u8 c, *pC;       /* Last character before the first wildcard */
      pC = (u8*)&pStr2->u.zToken[nPattern-1];
      c = *pC;
      if( noCase ){
        /* The point is to increment the last character before the first
        ** wildcard.  But if we increment '@', that will push it into the
        ** alphabetic range where case conversions will mess up the 
        ** inequality.  To avoid this, make sure to also run the full
        ** LIKE on all candidate expressions by clearing the isComplete flag
................................................................................
    assert( i>=0 && i<=SQLITE_INDEX_SAMPLES );
    *piRegion = i;
  }
  return SQLITE_OK;
}
#endif   /* #ifdef SQLITE_ENABLE_STAT2 */





































/*
** This function is used to estimate the number of rows that will be visited
** by scanning an index for a range of values. The range may have an upper
** bound, a lower bound, or both. The WHERE clause terms that set the upper
** and lower bounds are represented by pLower and pUpper respectively. For
** example, assuming that index p is on t1(a):
**
................................................................................
  WhereTerm *pLower,   /* Lower bound on the range. ex: "x>123" Might be NULL */
  WhereTerm *pUpper,   /* Upper bound on the range. ex: "x<455" Might be NULL */
  int *piEst           /* OUT: Return value */
){
  int rc = SQLITE_OK;

#ifdef SQLITE_ENABLE_STAT2
  sqlite3 *db = pParse->db;
  sqlite3_value *pLowerVal = 0;
  sqlite3_value *pUpperVal = 0;

  if( nEq==0 && p->aSample ){


    int iEst;
    int iLower = 0;
    int iUpper = SQLITE_INDEX_SAMPLES;
    u8 aff = p->pTable->aCol[0].affinity;

    if( pLower ){
      Expr *pExpr = pLower->pExpr->pRight;
      rc = sqlite3ValueFromExpr(db, pExpr, SQLITE_UTF8, aff, &pLowerVal);
    }
    if( rc==SQLITE_OK && pUpper ){
      Expr *pExpr = pUpper->pExpr->pRight;
      rc = sqlite3ValueFromExpr(db, pExpr, SQLITE_UTF8, aff, &pUpperVal);
    }

    if( rc!=SQLITE_OK || (pLowerVal==0 && pUpperVal==0) ){
      sqlite3ValueFree(pLowerVal);
      sqlite3ValueFree(pUpperVal);
      goto range_est_fallback;
    }else if( pLowerVal==0 ){
................................................................................
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   312,  959,  182,  628,    2,  157,  219,  450,   24,   24,
 /*    10 */    24,   24,  221,   26,   26,   26,   26,   27,   27,   28,
 /*    20 */    28,   28,   29,  221,  424,  425,   30,  492,   33,  141,
 /*    30 */   457,  463,   31,   26,   26,   26,   26,   27,   27,   28,
 /*    40 */    28,   28,   29,  221,   28,   28,   28,   29,  221,   23,
 /*    50 */    22,   32,  465,  466,  464,  464,   25,   25,   24,   24,
 /*    60 */    24,   24,  293,   26,   26,   26,   26,   27,   27,   28,
 /*    70 */    28,   28,   29,  221,  312,  450,  319,  479,  344,  208,
 /*    80 */    47,   26,   26,   26,   26,   27,   27,   28,   28,   28,
 /*    90 */    29,  221,  427,  428,  163,  339,  543,  368,  371,  372,
 /*   100 */   521,  317,  472,  473,  457,  463,  296,  373,  294,   21,
 /*   110 */   336,  367,  419,  416,  424,  425,  523,    1,  544,  446,
 /*   120 */    80,  424,  425,   23,   22,   32,  465,  466,  464,  464,
 /*   130 */    25,   25,   24,   24,   24,   24,  564,   26,   26,   26,
 /*   140 */    26,   27,   27,   28,   28,   28,   29,  221,  312,  233,
 /*   150 */   319,  441,  554,  152,  139,  263,  365,  268,  366,  160,
 /*   160 */   551,  352,  332,  421,  222,  272,  362,  322,  218,  557,
 /*   170 */   116,  339,  248,  574,  477,  223,  216,  573,  457,  463,
 /*   180 */   450,   59,  427,  428,  295,  610,  336,  563,  538,  427,
 /*   190 */   428,  385,  608,  609,  562,  446,   87,   23,   22,   32,
 /*   200 */   465,  466,  464,  464,   25,   25,   24,   24,   24,   24,
 /*   210 */   447,   26,   26,   26,   26,   27,   27,   28,   28,   28,
 /*   220 */    29,  221,  312,  233,  477,  223,  576,  134,  139,  263,
 /*   230 */   365,  268,  366,  160,  406,  354,  226,  498,  481,  272,
 /*   240 */   339,   27,   27,   28,   28,   28,   29,  221,  450,  442,
 /*   250 */   199,  540,  457,  463,  349,  336,  163,  551,   66,  368,
 /*   260 */   371,  372,  450,  415,  446,   80,  522,  581,  401,  373,
 /*   270 */   452,   23,   22,   32,  465,  466,  464,  464,   25,   25,
 /*   280 */    24,   24,   24,   24,  447,   26,   26,   26,   26,   27,
 /*   290 */    27,   28,   28,   28,   29,  221,  312,  339,  556,  607,
 /*   300 */   197,  454,  454,  454,  546,  578,  352,  198,  607,  440,
 /*   310 */    65,  351,  336,  426,  426,  399,  289,  424,  425,  606,
 /*   320 */   605,  446,   73,  426,  214,  219,  457,  463,  606,  410,
 /*   330 */   450,  241,  306,  196,  565,  479,  555,  208,  288,   29,
 /*   340 */   221,  447,    4,  874,  504,   23,   22,   32,  465,  466,
 /*   350 */   464,  464,   25,   25,   24,   24,   24,   24,  447,   26,
 /*   360 */    26,   26,   26,   27,   27,   28,   28,   28,   29,  221,
 /*   370 */   312,  163,  582,  339,  368,  371,  372,  314,  424,  425,
 /*   380 */   604,  222,  397,  227,  373,  427,  428,  339,  336,  409,
 /*   390 */   222,  478,  339,   30,  396,   33,  141,  446,   81,   62,
 /*   400 */   457,  463,  336,  157,  400,  450,  504,  336,  438,  426,
 /*   410 */   500,  446,   87,   41,  380,  613,  446,   80,  581,   23,
 /*   420 */    22,   32,  465,  466,  464,  464,   25,   25,   24,   24,
 /*   430 */    24,   24,  213,   26,   26,   26,   26,   27,   27,   28,
 /*   440 */    28,   28,   29,  221,  312,  513,  427,  428,  517,  254,
 /*   450 */   524,  386,  225,  339,  486,  363,  389,  339,  356,  443,
 /*   460 */   494,  236,   30,  497,   33,  141,  399,  289,  336,  495,
 /*   470 */   487,  501,  336,  450,  457,  463,  219,  446,   95,  445,
 /*   480 */    68,  446,   95,  444,  424,  425,  488,   44,  348,  288,
 /*   490 */   504,  424,  425,   23,   22,   32,  465,  466,  464,  464,
 /*   500 */    25,   25,   24,   24,   24,   24,  391,   26,   26,   26,
 /*   510 */    26,   27,   27,   28,   28,   28,   29,  221,  312,  361,
 /*   520 */   556,  426,  520,  328,  191,  271,  339,  329,  247,  259,
 /*   530 */   339,  566,   65,  249,  336,  426,  424,  425,  445,  516,
 /*   540 */   426,  336,  444,  446,    9,  336,  556,  451,  457,  463,
 /*   550 */   446,   74,  427,  428,  446,   69,  192,  618,   65,  427,
 /*   560 */   428,  426,  323,  277,   16,  202,  189,   23,   22,   32,
 /*   570 */   465,  466,  464,  464,   25,   25,   24,   24,   24,   24,
 /*   580 */   255,   26,   26,   26,   26,   27,   27,   28,   28,   28,
 /*   590 */    29,  221,  312,  339,  486,  426,  537,  235,  515,  447,
 /*   600 */   339,  629,  419,  416,  427,  428,  217,  281,  336,  279,
 /*   610 */   487,  203,  144,  526,  527,  336,  391,  446,   78,  429,
 /*   620 */   430,  431,  457,  463,  446,   99,  488,  341,  528,  468,
 /*   630 */   468,  426,  343,  472,  473,  626,  949,  474,  949,  529,
 /*   640 */   447,   23,   22,   32,  465,  466,  464,  464,   25,   25,
 /*   650 */    24,   24,   24,   24,  339,   26,   26,   26,   26,   27,
 /*   660 */    27,   28,   28,   28,   29,  221,  312,  339,  162,  336,
 /*   670 */   275,  283,  476,  376,  339,  579,  527,  346,  446,   98,
 /*   680 */   622,   30,  336,   33,  141,  339,  426,  339,  508,  336,
 /*   690 */   469,  446,  105,  418,    2,  222,  457,  463,  446,  101,
 /*   700 */   336,  219,  336,  426,  161,  626,  948,  290,  948,  446,
 /*   710 */   108,  446,  109,  398,  284,   23,   22,   32,  465,  466,
 /*   720 */   464,  464,   25,   25,   24,   24,   24,   24,  339,   26,
 /*   730 */    26,   26,   26,   27,   27,   28,   28,   28,   29,  221,
 /*   740 */   312,  339,  271,  336,  339,   58,  535,  482,  143,  339,
 /*   750 */   622,  318,  446,  133,  408,  257,  336,  426,  321,  336,
 /*   760 */   357,  339,  272,  426,  336,  446,  135,  184,  446,   61,
 /*   770 */   457,  463,  219,  446,  106,  426,  336,  493,  341,  234,
 /*   780 */   468,  468,  621,  310,  407,  446,  102,  209,  144,   23,
 /*   790 */    22,   32,  465,  466,  464,  464,   25,   25,   24,   24,
 /*   800 */    24,   24,  339,   26,   26,   26,   26,   27,   27,   28,
 /*   810 */    28,   28,   29,  221,  312,  339,  271,  336,  339,  341,
 /*   820 */   538,  468,  468,  572,  383,  496,  446,   79,  499,  549,
 /*   830 */   336,  426,  508,  336,  508,  341,  339,  468,  468,  446,
 /*   840 */   103,  391,  446,   70,  457,  463,  572,  426,   40,  426,
 /*   850 */    42,  336,  220,  324,  504,  341,  426,  468,  468,   18,
 /*   860 */   446,  100,  266,   23,   22,   32,  465,  466,  464,  464,
 /*   870 */    25,   25,   24,   24,   24,   24,  339,   26,   26,   26,
 /*   880 */    26,   27,   27,   28,   28,   28,   29,  221,  312,  339,
 /*   890 */   283,  336,  339,  261,  548,  384,  339,  327,  142,  550,
 /*   900 */   446,  136,  475,  475,  336,  426,  185,  336,  499,  396,
 /*   910 */   339,  336,  370,  446,  137,  256,  446,  138,  457,  463,
 /*   920 */   446,   71,  499,  360,  426,  336,  161,  311,  623,  215,
 /*   930 */   426,  359,  237,  412,  446,   82,  200,   23,   34,   32,
 /*   940 */   465,  466,  464,  464,   25,   25,   24,   24,   24,   24,
 /*   950 */   339,   26,   26,   26,   26,   27,   27,   28,   28,   28,
 /*   960 */    29,  221,  312,  447,  271,  336,  339,  271,  340,  210,
 /*   970 */   447,  172,  625,  211,  446,   83,  240,  552,  142,  426,
 /*   980 */   321,  336,  426,  426,  339,  414,  331,  181,  458,  459,
 /*   990 */   446,   72,  457,  463,  470,  506,   67,  158,  394,  336,
 /*  1000 */   587,  325,  499,  447,  326,  311,  624,  447,  446,   84,
 /*  1010 */   461,  462,   22,   32,  465,  466,  464,  464,   25,   25,
 /*  1020 */    24,   24,   24,   24,  339,   26,   26,   26,   26,   27,
 /*  1030 */    27,   28,   28,   28,   29,  221,  312,  460,  339,  336,
 /*  1040 */   339,  283,  423,  393,  532,  533,  204,  205,  446,   85,
 /*  1050 */   625,  392,  547,  336,  162,  336,  426,  426,  339,  435,
 /*  1060 */   436,  339,  446,  104,  446,   86,  457,  463,  264,  291,
 /*  1070 */   274,   49,  162,  336,  426,  426,  336,  297,  265,  542,
 /*  1080 */   541,  405,  446,   88,  594,  446,   89,   32,  465,  466,
 /*  1090 */   464,  464,   25,   25,   24,   24,   24,   24,  600,   26,
 /*  1100 */    26,   26,   26,   27,   27,   28,   28,   28,   29,  221,
 /*  1110 */    36,  345,  339,    3,  214,    8,  422,  335,  425,  437,
 /*  1120 */   375,  148,  162,   36,  345,  339,    3,  336,  342,  432,
 /*  1130 */   335,  425,  149,  577,  426,  162,  446,   90,  151,  339,
 /*  1140 */   336,  342,  434,  339,  283,  433,  333,  347,  447,  446,
 /*  1150 */    75,  588,    6,  158,  336,  448,  140,  481,  336,  426,
 /*  1160 */   347,  453,  334,  446,   76,   49,  350,  446,   91,    7,
 /*  1170 */   481,  426,  397,  283,  355,  250,  426,   39,   38,  251,
 /*  1180 */   339,  426,   48,  353,   37,  337,  338,  596,  426,  452,
 /*  1190 */    39,   38,  514,  252,  390,  336,   20,   37,  337,  338,
 /*  1200 */   253,   43,  452,  206,  446,   92,  219,  449,  242,  243,
 /*  1210 */   244,  150,  246,  283,  491,  593,  597,  490,  224,  258,
 /*  1220 */   454,  454,  454,  455,  456,   10,  503,  183,  426,  178,
 /*  1230 */   156,  301,  426,  454,  454,  454,  455,  456,   10,  339,
 /*  1240 */   302,  426,   36,  345,   50,    3,  339,  505,  260,  335,
 /*  1250 */   425,  262,  339,  176,  336,  581,  598,  358,  364,  175,
 /*  1260 */   342,  336,  177,  446,   93,   46,  345,  336,    3,  339,
 /*  1270 */   446,   94,  335,  425,  525,  339,  446,   77,  320,  347,
 /*  1280 */   511,  339,  507,  342,  336,  589,  601,   56,   56,  481,
 /*  1290 */   336,  512,  283,  446,   17,  531,  336,  426,  530,  446,
 /*  1300 */    96,  534,  347,  404,  298,  446,   97,  426,  313,   39,
 /*  1310 */    38,  267,  481,  219,  535,  536,   37,  337,  338,  283,
 /*  1320 */   620,  452,  309,  283,  111,   19,  288,  509,  269,  424,
 /*  1330 */   425,  539,   39,   38,  426,  238,  270,  411,  426,   37,
 /*  1340 */   337,  338,  426,  426,  452,  558,  426,  307,  231,  276,
 /*  1350 */   278,  426,  454,  454,  454,  455,  456,   10,  553,  280,
 /*  1360 */   426,  559,  239,  230,  426,  426,  299,  282,  287,  481,
 /*  1370 */   560,  388,  584,  232,  426,  454,  454,  454,  455,  456,
 /*  1380 */    10,  561,  426,  426,  585,  395,  426,  426,  292,  194,
 /*  1390 */   195,  592,  603,  300,  303,  308,  377,  522,  381,  426,
 /*  1400 */   426,  452,  567,  426,  304,  617,  426,  426,  426,  426,
 /*  1410 */   379,   53,  147,  165,  166,  167,  580,  212,  569,  426,
 /*  1420 */   426,  285,  168,  570,  387,  120,  123,  187,  590,  402,
 /*  1430 */   403,  125,  454,  454,  454,  330,  599,  614,  186,  126,
 /*  1440 */   127,  128,  615,  616,   57,   60,  619,  107,  229,   64,
 /*  1450 */   115,  420,  245,  130,  439,  180,  315,  207,  670,  316,
 /*  1460 */   671,  467,  672,  153,  154,   35,  483,  471,  480,  188,
 /*  1470 */   201,  155,  484,    5,  485,  489,   12,  502,   45,   11,
 /*  1480 */   110,  145,  518,  519,  510,  228,   51,  112,  369,  273,
 /*  1490 */   113,  159,  545,   52,  374,  114,  164,  265,  378,  190,
 /*  1500 */   146,  568,  117,  158,  286,  382,  169,  119,   15,  583,
 /*  1510 */   170,  171,  121,  586,  122,   54,   55,   13,  124,  591,
 /*  1520 */   173,  174,  118,  575,  129,  595,  571,  131,   14,  132,
 /*  1530 */   611,   63,  612,  193,  602,  179,  305,  413,  417,  960,
 /*  1540 */   627,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    19,  142,  143,  144,  145,   24,  115,   26,   77,   78,
 /*    10 */    79,   80,   92,   82,   83,   84,   85,   86,   87,   88,
 /*    20 */    89,   90,   91,   92,   26,   27,  222,  223,  224,  225,
 /*    30 */    49,   50,   81,   82,   83,   84,   85,   86,   87,   88,
 /*    40 */    89,   90,   91,   92,   88,   89,   90,   91,   92,   68,
 /*    50 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*    60 */    79,   80,   16,   82,   83,   84,   85,   86,   87,   88,
 /*    70 */    89,   90,   91,   92,   19,   94,   19,  166,  167,  168,
 /*    80 */    25,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*    90 */    91,   92,   94,   95,   96,  150,   36,   99,  100,  101,
 /*   100 */   174,  169,  170,  171,   49,   50,   60,  109,   62,   54,
 /*   110 */   165,   51,    1,    2,   26,   27,  174,   22,   58,  174,
 /*   120 */   175,   26,   27,   68,   69,   70,   71,   72,   73,   74,
 /*   130 */    75,   76,   77,   78,   79,   80,  186,   82,   83,   84,
 /*   140 */    85,   86,   87,   88,   89,   90,   91,   92,   19,   92,
 /*   150 */    19,  172,  173,   96,   97,   98,   99,  100,  101,  102,
 /*   160 */   181,  216,  146,  147,  232,  108,  221,  107,  152,  186,
 /*   170 */   154,  150,  195,   30,   86,   87,  160,   34,   49,   50,
 /*   180 */    26,   52,   94,   95,  138,   97,  165,  181,  182,   94,
 /*   190 */    95,   48,  104,  105,  188,  174,  175,   68,   69,   70,
 /*   200 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   210 */   194,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   220 */    91,   92,   19,   92,   86,   87,   21,   24,   97,   98,
 /*   230 */    99,  100,  101,  102,  218,  214,  215,  208,   66,  108,
 /*   240 */   150,   86,   87,   88,   89,   90,   91,   92,   94,  173,
 /*   250 */   160,  183,   49,   50,  191,  165,   96,  181,   22,   99,
 /*   260 */   100,  101,   26,  247,  174,  175,   94,   57,   63,  109,
 /*   270 */    98,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   280 */    77,   78,   79,   80,  194,   82,   83,   84,   85,   86,
 /*   290 */    87,   88,   89,   90,   91,   92,   19,  150,  150,  150,
 /*   300 */    25,  129,  130,  131,  183,  100,  216,  160,  150,  161,
 /*   310 */   162,  221,  165,  165,  165,  105,  106,   26,   27,  170,
 /*   320 */   171,  174,  175,  165,  160,  115,   49,   50,  170,  171,
 /*   330 */    94,  148,  163,  185,  186,  166,  167,  168,  128,   91,
 /*   340 */    92,  194,  196,  138,  166,   68,   69,   70,   71,   72,
 /*   350 */    73,   74,   75,   76,   77,   78,   79,   80,  194,   82,
 /*   360 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*   370 */    19,   96,   11,  150,   99,  100,  101,  155,   26,   27,
 /*   380 */   231,  232,  218,  205,  109,   94,   95,  150,  165,  231,
 /*   390 */   232,  166,  150,  222,  150,  224,  225,  174,  175,  235,
 /*   400 */    49,   50,  165,   24,  240,   26,  166,  165,  153,  165,
 /*   410 */   119,  174,  175,  136,  237,  244,  174,  175,   57,   68,
 /*   420 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*   430 */    79,   80,  236,   82,   83,   84,   85,   86,   87,   88,
 /*   440 */    89,   90,   91,   92,   19,  205,   94,   95,   23,  226,
 /*   450 */   165,  229,  215,  150,   12,   88,  234,  150,  216,  174,
 /*   460 */    32,  217,  222,   25,  224,  225,  105,  106,  165,   41,
 /*   470 */    28,  119,  165,   94,   49,   50,  115,  174,  175,  112,
 /*   480 */    22,  174,  175,  116,   26,   27,   44,  136,   46,  128,
 /*   490 */   166,   26,   27,   68,   69,   70,   71,   72,   73,   74,
 /*   500 */    75,   76,   77,   78,   79,   80,  150,   82,   83,   84,
 /*   510 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  150,
 /*   520 */   150,  165,   23,  220,  196,  150,  150,  220,  158,  205,
 /*   530 */   150,  161,  162,  198,  165,  165,   26,   27,  112,   23,
 /*   540 */   165,  165,  116,  174,  175,  165,  150,  166,   49,   50,
 /*   550 */   174,  175,   94,   95,  174,  175,  118,  161,  162,   94,
 /*   560 */    95,  165,  187,   16,   22,  160,   24,   68,   69,   70,
 /*   570 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   580 */   150,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   590 */    91,   92,   19,  150,   12,  165,   23,  241,   88,  194,
 /*   600 */   150,    0,    1,    2,   94,   95,  160,   60,  165,   62,
 /*   610 */    28,  206,  207,  190,  191,  165,  150,  174,  175,    7,
 /*   620 */     8,    9,   49,   50,  174,  175,   44,  111,   46,  113,
 /*   630 */   114,  165,  169,  170,  171,   22,   23,  233,   25,   57,
 /*   640 */   194,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   650 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,
 /*   660 */    87,   88,   89,   90,   91,   92,   19,  150,   25,  165,
 /*   670 */    23,  150,  233,   19,  150,  190,  191,  228,  174,  175,
 /*   680 */    67,  222,  165,  224,  225,  150,  165,  150,  150,  165,
 /*   690 */    23,  174,  175,  144,  145,  232,   49,   50,  174,  175,
 /*   700 */   165,  115,  165,  165,   50,   22,   23,  241,   25,  174,
 /*   710 */   175,  174,  175,  127,  193,   68,   69,   70,   71,   72,
 /*   720 */    73,   74,   75,   76,   77,   78,   79,   80,  150,   82,
 /*   730 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*   740 */    19,  150,  150,  165,  150,   24,  103,   23,  150,  150,
 /*   750 */    67,  213,  174,  175,   97,  209,  165,  165,  104,  165,
 /*   760 */   150,  150,  108,  165,  165,  174,  175,   23,  174,  175,
 /*   770 */    49,   50,  115,  174,  175,  165,  165,  177,  111,  187,
 /*   780 */   113,  114,  250,  251,  127,  174,  175,  206,  207,   68,
 /*   790 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*   800 */    79,   80,  150,   82,   83,   84,   85,   86,   87,   88,
 /*   810 */    89,   90,   91,   92,   19,  150,  150,  165,  150,  111,
 /*   820 */   182,  113,  114,  105,  106,  177,  174,  175,   25,  166,
 /*   830 */   165,  165,  150,  165,  150,  111,  150,  113,  114,  174,
 /*   840 */   175,  150,  174,  175,   49,   50,  128,  165,  135,  165,
 /*   850 */   137,  165,  197,  187,  166,  111,  165,  113,  114,  204,
 /*   860 */   174,  175,  177,   68,   69,   70,   71,   72,   73,   74,
 /*   870 */    75,   76,   77,   78,   79,   80,  150,   82,   83,   84,
 /*   880 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  150,
 /*   890 */   150,  165,  150,  205,  177,  213,  150,  213,   95,  177,
 /*   900 */   174,  175,  129,  130,  165,  165,   23,  165,   25,  150,
 /*   910 */   150,  165,  178,  174,  175,  150,  174,  175,   49,   50,
 /*   920 */   174,  175,  119,   19,  165,  165,   50,   22,   23,  160,
 /*   930 */   165,   27,  241,  193,  174,  175,  160,   68,   69,   70,
 /*   940 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   950 */   150,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   960 */    91,   92,   19,  194,  150,  165,  150,  150,  150,  160,
 /*   970 */   194,   25,   67,  160,  174,  175,  217,  166,   95,  165,
 /*   980 */   104,  165,  165,  165,  150,  245,  248,  249,   49,   50,
 /*   990 */   174,  175,   49,   50,   23,   23,   25,   25,  242,  165,
 /*  1000 */   199,  187,  119,  194,  187,   22,   23,  194,  174,  175,
 /*  1010 */    71,   72,   69,   70,   71,   72,   73,   74,   75,   76,
 /*  1020 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,
 /*  1030 */    87,   88,   89,   90,   91,   92,   19,   98,  150,  165,
 /*  1040 */   150,  150,  150,   19,    7,    8,  105,  106,  174,  175,
 /*  1050 */    67,   27,   23,  165,   25,  165,  165,  165,  150,  150,
 /*  1060 */   150,  150,  174,  175,  174,  175,   49,   50,   98,  242,
 /*  1070 */    23,  125,   25,  165,  165,  165,  165,  209,  108,   97,
 /*  1080 */    98,  209,  174,  175,  193,  174,  175,   70,   71,   72,
 /*  1090 */    73,   74,   75,   76,   77,   78,   79,   80,  199,   82,
 /*  1100 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*  1110 */    19,   20,  150,   22,  160,   22,  149,   26,   27,  150,
 /*  1120 */    23,    6,   25,   19,   20,  150,   22,  165,   37,  149,
 /*  1130 */    26,   27,  151,   23,  165,   25,  174,  175,  151,  150,
 /*  1140 */   165,   37,   13,  150,  150,  149,  149,   56,  194,  174,
 /*  1150 */   175,   23,   25,   25,  165,  194,  150,   66,  165,  165,
 /*  1160 */    56,  150,  159,  174,  175,  125,  150,  174,  175,   76,
 /*  1170 */    66,  165,  218,  150,  122,  199,  165,   86,   87,  200,
 /*  1180 */   150,  165,  123,  121,   93,   94,   95,  193,  165,   98,
 /*  1190 */    86,   87,   88,  201,  240,  165,  124,   93,   94,   95,
 /*  1200 */   202,  135,   98,    5,  174,  175,  115,  203,   10,   11,
 /*  1210 */    12,   13,   14,  150,  157,   17,  193,  150,  227,  210,
 /*  1220 */   129,  130,  131,  132,  133,  134,  150,  157,  165,   31,
 /*  1230 */   117,   33,  165,  129,  130,  131,  132,  133,  134,  150,
 /*  1240 */    42,  165,   19,   20,  104,   22,  150,  211,  210,   26,
 /*  1250 */    27,  210,  150,   55,  165,   57,  193,  120,  104,   61,
 /*  1260 */    37,  165,   64,  174,  175,   19,   20,  165,   22,  150,
 /*  1270 */   174,  175,   26,   27,  176,  150,  174,  175,   47,   56,
 /*  1280 */   211,  150,  150,   37,  165,   23,   23,   25,   25,   66,
 /*  1290 */   165,  211,  150,  174,  175,  184,  165,  165,  176,  174,
 /*  1300 */   175,  178,   56,  105,  106,  174,  175,  165,  110,   86,
 /*  1310 */    87,  176,   66,  115,  103,  176,   93,   94,   95,  150,
 /*  1320 */    23,   98,   25,  150,   22,   22,  128,  150,  150,   26,
 /*  1330 */    27,  150,   86,   87,  165,  193,  150,  139,  165,   93,
 /*  1340 */    94,   95,  165,  165,   98,  150,  165,  179,   92,  150,
 /*  1350 */   150,  165,  129,  130,  131,  132,  133,  134,  184,  150,
 /*  1360 */   165,  176,  193,  230,  165,  165,  193,  150,  150,   66,
 /*  1370 */   176,  150,  150,  230,  165,  129,  130,  131,  132,  133,
 /*  1380 */   134,  176,  165,  165,  150,  150,  165,  165,  150,   86,
 /*  1390 */    87,  150,  150,  150,  150,  179,   18,   94,   45,  165,
 /*  1400 */   165,   98,  157,  165,  150,  150,  165,  165,  165,  165,
 /*  1410 */   157,  135,   68,  156,  156,  156,  189,  157,  157,  165,
 /*  1420 */   165,  238,  156,  239,  157,  189,   22,  219,  199,  157,
 /*  1430 */    18,  192,  129,  130,  131,  157,  199,   40,  219,  192,
 /*  1440 */   192,  192,  157,  157,  243,  243,   38,  164,  180,  246,
 /*  1450 */   180,    1,   15,  189,   23,  249,  252,   22,  117,  252,
 /*  1460 */   117,  112,  117,  117,  117,   22,   11,   23,   23,   22,
 /*  1470 */    22,   25,   23,   35,   23,   23,   35,  119,   25,   25,
 /*  1480 */    22,  117,   23,   23,   27,   52,   22,   22,   52,   23,
 /*  1490 */    22,   35,   29,   22,   52,   22,  102,  108,   19,   24,
 /*  1500 */    39,   20,  104,   25,  138,   43,  104,   22,    5,    1,
 /*  1510 */   117,   35,  107,   27,  126,   76,   76,   22,  118,    1,
 /*  1520 */    16,  120,   53,   53,  118,   20,   59,  107,   22,  126,
 /*  1530 */    23,   16,   23,   22,  127,   15,  140,   65,    3,  253,
 /*  1540 */     4,
};
#define YY_SHIFT_USE_DFLT (-110)
#define YY_SHIFT_MAX 417
static const short yy_shift_ofst[] = {
 /*     0 */   111, 1091, 1198, 1091, 1223, 1223,   -2,   88,   88,  -19,
 /*    10 */  1223, 1223, 1223, 1223, 1223,  210,  465,  129, 1104, 1223,
 /*    20 */  1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
 /*    30 */  1223, 1223, 1246, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
 /*    40 */  1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
 /*    50 */  1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
 /*    60 */  1223,  -49,  361,  465,  465,  154,  138,  138, -109,   55,
 /*    70 */   203,  277,  351,  425,  499,  573,  647,  721,  795,  869,
 /*    80 */   795,  795,  795,  795,  795,  795,  795,  795,  795,  795,
 /*    90 */   795,  795,  795,  795,  795,  795,  795,  795,  943, 1017,
 /*   100 */  1017,  -69,  -69,  -69,  -69,   -1,   -1,   57,  155,  -44,
 /*   110 */   465,  465,  465,  465,  465,  654,  205,  465,  465,  465,
 /*   120 */   465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
 /*   130 */   465,  465,  465,  248,  154,  -80, -110, -110, -110, 1303,
 /*   140 */   131,   95,  291,  352,  458,  510,  582,  582,  465,  465,
 /*   150 */   465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
 /*   160 */   465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
 /*   170 */   465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
 /*   180 */   613,  683,  601,  379,  379,  379,  657,  586, -109, -109,
 /*   190 */  -109, -110, -110, -110,  172,  172,  275,  160,  516,  667,
 /*   200 */   724,  442,  744,  883,   60,   60,  612,  367,  236,  803,
 /*   210 */   708,  708,  143,  718,  708,  708,  708,  708,  542,  426,
 /*   220 */   438,  154,  773,  773,  713,  428,  428,  904,  428,  876,
 /*   230 */   428,  154,  428,  154,  643, 1024,  946, 1024,  904,  904,
 /*   240 */   946, 1115, 1115, 1115, 1115, 1129, 1129, 1127, -109, 1040,
 /*   250 */  1052, 1059, 1062, 1072, 1066, 1113, 1113, 1140, 1137, 1140,
 /*   260 */  1137, 1140, 1137, 1154, 1154, 1231, 1154, 1211, 1154, 1302,
 /*   270 */  1256, 1256, 1231, 1154, 1154, 1154, 1302, 1378, 1113, 1378,
 /*   280 */  1113, 1378, 1113, 1113, 1353, 1276, 1378, 1113, 1344, 1344,
 /*   290 */  1404, 1040, 1113, 1412, 1412, 1412, 1412, 1040, 1344, 1404,
 /*   300 */  1113, 1397, 1397, 1113, 1113, 1408, -110, -110, -110, -110,
 /*   310 */  -110, -110,  939,   46,  547,  905,  983,  971,  972,  970,
 /*   320 */  1037,  941,  982, 1029, 1047, 1097, 1110, 1128, 1262, 1263,
 /*   330 */  1093, 1297, 1450, 1437, 1431, 1435, 1341, 1343, 1345, 1346,
 /*   340 */  1347, 1349, 1443, 1444, 1445, 1447, 1455, 1448, 1449, 1446,
 /*   350 */  1451, 1452, 1453, 1438, 1454, 1441, 1453, 1358, 1458, 1456,
 /*   360 */  1457, 1364, 1459, 1460, 1461, 1433, 1464, 1463, 1436, 1465,
 /*   370 */  1466, 1468, 1471, 1442, 1473, 1394, 1389, 1479, 1481, 1475,
 /*   380 */  1398, 1462, 1467, 1469, 1478, 1470, 1366, 1402, 1485, 1503,
 /*   390 */  1508, 1393, 1476, 1486, 1405, 1439, 1440, 1388, 1495, 1400,
 /*   400 */  1518, 1504, 1401, 1505, 1406, 1420, 1403, 1506, 1407, 1507,
 /*   410 */  1509, 1515, 1472, 1520, 1396, 1511, 1535, 1536,
};
#define YY_REDUCE_USE_DFLT (-197)
#define YY_REDUCE_MAX 311
static const short yy_reduce_ofst[] = {
 /*     0 */  -141,   90,   16,  147,  -55,   21,  148,  149,  158,  240,
 /*    10 */   223,  237,  242,  303,  307,  164,  370,  171,  369,  376,
 /*    20 */   380,  443,  450,  504,  517,  524,  535,  537,  578,  591,
 /*    30 */   594,  599,  611,  652,  665,  668,  686,  726,  739,  742,
 /*    40 */   746,  760,  800,  816,  834,  874,  888,  890,  908,  911,
 /*    50 */   962,  975,  989,  993, 1030, 1089, 1096, 1102, 1119, 1125,
 /*    60 */  1131, -196,  954,  740,  396,  169,  -68,  463,  405,  459,
 /*    70 */   459,  459,  459,  459,  459,  459,  459,  459,  459,  459,
 /*    80 */   459,  459,  459,  459,  459,  459,  459,  459,  459,  459,
 /*    90 */   459,  459,  459,  459,  459,  459,  459,  459,  459,  459,
 /*   100 */   459,  459,  459,  459,  459,  459,  459,  -21,  459,  459,
 /*   110 */   538,  375,  592,  666,  814,    6,  222,  521,  682,  817,
 /*   120 */   356,  244,  466,  684,  691,  891,  994, 1023, 1063, 1142,
 /*   130 */  1169,  759, 1173,  459,  -89,  459,  459,  459,  459,  285,
 /*   140 */    76,  430,  598,  610,  765,  818,  423,  485,  892,  909,
 /*   150 */   910,  969, 1006,  818, 1011, 1016, 1067, 1076, 1132, 1177,
 /*   160 */  1178, 1181, 1186, 1195, 1199, 1200, 1209, 1217, 1218, 1221,
 /*   170 */  1222, 1234, 1235, 1238, 1241, 1242, 1243, 1244, 1254, 1255,
 /*   180 */   532,  532,  549,  178,  324,  688,  446,  769,  776,  809,
 /*   190 */   813,  655,  581,  738,  -74,  -58,  -50,  -17,  -23,  -23,
 /*   200 */   -23,   63,  -23,   29,   68,  121,  183,  146,  225,   29,
 /*   210 */   -23,  -23,  196,  177,  -23,  -23,  -23,  -23,  255,  328,
 /*   220 */   335,  381,  404,  439,  449,  600,  648,  546,  685,  638,
 /*   230 */   717,  663,  722,  811,  734,  756,  801,  827,  868,  872,
 /*   240 */   899,  967,  980,  996,  997,  981,  987, 1003,  961,  976,
 /*   250 */   979,  992,  998, 1004,  991, 1057, 1070, 1009, 1036, 1038,
 /*   260 */  1069, 1041, 1080, 1098, 1122, 1111, 1135, 1123, 1139, 1168,
 /*   270 */  1133, 1143, 1174, 1185, 1194, 1205, 1216, 1257, 1245, 1258,
 /*   280 */  1253, 1259, 1260, 1261, 1183, 1184, 1266, 1267, 1227, 1236,
 /*   290 */  1208, 1229, 1272, 1239, 1247, 1248, 1249, 1237, 1264, 1219,
 /*   300 */  1278, 1201, 1202, 1285, 1286, 1203, 1283, 1268, 1270, 1206,
 /*   310 */  1204, 1207,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   634,  869,  958,  958,  869,  958,  958,  898,  898,  757,
 /*    10 */   867,  958,  958,  958,  958,  958,  958,  932,  958,  958,
 /*    20 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    30 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    40 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    50 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    60 */   958,  841,  958,  958,  958,  673,  898,  898,  761,  792,
 /*    70 */   958,  958,  958,  958,  958,  958,  958,  958,  793,  958,
 /*    80 */   871,  866,  862,  864,  863,  870,  794,  783,  790,  797,
 /*    90 */   772,  911,  799,  800,  806,  807,  933,  931,  829,  828,
 /*   100 */   847,  831,  845,  853,  846,  830,  840,  665,  832,  833,
 /*   110 */   958,  958,  958,  958,  958,  726,  660,  958,  958,  958,
 /*   120 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   130 */   958,  958,  958,  834,  958,  835,  848,  849,  850,  958,
 /*   140 */   958,  958,  958,  958,  958,  958,  958,  958,  640,  958,
 /*   150 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   160 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   170 */   958,  958,  958,  958,  958,  882,  958,  936,  938,  958,
 /*   180 */   958,  958,  634,  757,  757,  757,  958,  958,  958,  958,
 /*   190 */   958,  751,  761,  950,  958,  958,  717,  958,  958,  958,
 /*   200 */   958,  958,  958,  958,  958,  958,  642,  749,  675,  759,
 /*   210 */   662,  738,  904,  958,  923,  921,  740,  802,  958,  749,
 /*   220 */   758,  958,  958,  958,  865,  786,  786,  774,  786,  696,
 /*   230 */   786,  958,  786,  958,  699,  916,  796,  916,  774,  774,
 /*   240 */   796,  639,  639,  639,  639,  650,  650,  716,  958,  796,
 /*   250 */   787,  789,  779,  791,  958,  765,  765,  773,  778,  773,
 /*   260 */   778,  773,  778,  728,  728,  713,  728,  699,  728,  875,
 /*   270 */   879,  879,  713,  728,  728,  728,  875,  657,  765,  657,
 /*   280 */   765,  657,  765,  765,  908,  910,  657,  765,  730,  730,
 /*   290 */   808,  796,  765,  737,  737,  737,  737,  796,  730,  808,
 /*   300 */   765,  935,  935,  765,  765,  943,  683,  701,  701,  950,
 /*   310 */   955,  955,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   320 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   330 */   884,  958,  958,  648,  958,  667,  815,  820,  816,  958,
 /*   340 */   817,  743,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   350 */   958,  958,  868,  958,  780,  958,  788,  958,  958,  958,
 /*   360 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   370 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   380 */   958,  958,  958,  906,  907,  958,  958,  958,  958,  958,
 /*   390 */   958,  914,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   400 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   410 */   958,  958,  942,  958,  958,  945,  635,  958,  630,  632,
 /*   420 */   633,  637,  638,  641,  667,  668,  670,  671,  672,  643,
 /*   430 */   644,  645,  646,  647,  649,  653,  651,  652,  654,  661,
 /*   440 */   663,  682,  684,  686,  747,  748,  812,  741,  742,  746,
 /*   450 */   669,  823,  814,  818,  819,  821,  822,  836,  837,  839,
 /*   460 */   844,  852,  855,  838,  843,  851,  854,  744,  745,  858,
 /*   470 */   676,  677,  680,  681,  894,  896,  895,  897,  679,  678,
 /*   480 */   824,  827,  860,  861,  924,  925,  926,  927,  928,  856,
 /*   490 */   766,  859,  842,  781,  784,  785,  782,  750,  760,  768,
 /*   500 */   769,  770,  771,  755,  756,  762,  777,  810,  811,  775,
 /*   510 */   776,  763,  764,  752,  753,  754,  857,  813,  825,  826,
 /*   520 */   687,  688,  820,  689,  690,  691,  729,  732,  733,  734,
 /*   530 */   692,  711,  714,  715,  693,  700,  694,  695,  702,  703,
 /*   540 */   704,  706,  707,  708,  709,  710,  705,  876,  877,  880,
 /*   550 */   878,  697,  698,  712,  685,  674,  666,  718,  721,  722,
 /*   560 */   723,  724,  725,  727,  719,  720,  664,  655,  658,  767,
 /*   570 */   900,  909,  905,  901,  902,  903,  659,  872,  873,  731,
 /*   580 */   804,  805,  899,  912,  915,  917,  918,  919,  809,  920,
 /*   590 */   922,  913,  947,  656,  735,  736,  739,  881,  929,  795,
 /*   600 */   798,  801,  803,  883,  885,  887,  889,  890,  891,  892,
 /*   610 */   893,  886,  888,  930,  934,  937,  939,  940,  941,  944,
 /*   620 */   946,  951,  952,  953,  956,  957,  954,  636,  631,
};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))

/* The next table maps tokens into fallback tokens.  If a construct
** like the following:
** 
**      %fallback ID X Y Z.
................................................................................
      case 68: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy328);}
        break;
      case 69: /* ccons ::= COLLATE ids */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
        break;
      case 72: /* refargs ::= */
{ yygotominor.yy328 = OE_None * 0x000101; }
        break;
      case 73: /* refargs ::= refargs refarg */
{ yygotominor.yy328 = (yymsp[-1].minor.yy328 & ~yymsp[0].minor.yy429.mask) | yymsp[0].minor.yy429.value; }
        break;
      case 74: /* refarg ::= MATCH nm */
{ yygotominor.yy429.value = 0;     yygotominor.yy429.mask = 0x000000; }
        break;
................................................................................
      case 75: /* refarg ::= ON DELETE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328;     yygotominor.yy429.mask = 0x0000ff; }
        break;
      case 76: /* refarg ::= ON UPDATE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328<<8;  yygotominor.yy429.mask = 0x00ff00; }
        break;
      case 77: /* refact ::= SET NULL */
{ yygotominor.yy328 = OE_SetNull; }
        break;
      case 78: /* refact ::= SET DEFAULT */
{ yygotominor.yy328 = OE_SetDflt; }
        break;
      case 79: /* refact ::= CASCADE */
{ yygotominor.yy328 = OE_Cascade; }
        break;
      case 80: /* refact ::= RESTRICT */
{ yygotominor.yy328 = OE_Restrict; }
        break;
      case 81: /* refact ::= NO ACTION */
{ yygotominor.yy328 = OE_None; }
        break;
      case 83: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 98: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==98);
      case 100: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==100);
      case 103: /* resolvetype ::= raisetype */ yytestcase(yyruleno==103);
{yygotominor.yy328 = yymsp[0].minor.yy328;}
        break;
................................................................................
      42,  12,  74,  15,   0, 113,  81,  50, 108,   0,  19,   0,   0,
     118,   0, 116, 111,   0,  22,  89,   0,   9,   0,   0,  66,  67,
       0,  65,   6,   0,  48,  86,  98,   0, 115,  97,   0,   0,  45,
       0,  99,  24,   0,  17,   0, 119,  49,  23,   0,   5, 106,  25,
      92,   0,   0, 121, 102,  56, 120,  53,  28,  51,   0,  87,   0,
      96,  26,   0,  95,   0,   0,   0,  91,  88,  93,  84, 105,  14,
      39, 104,   0,  77,   0,  18,  85, 107,  32,   0, 117,  76, 109,
      59,  46,  80,   0,   0,  90,  40,   0, 112,   0,  36,   0,   0,
      29,   0,  82,  58,  60,   0,  20,  57,   0,  52,
  };
  static const unsigned char aNext[121] = {
       0,   0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   2,   0,   0,   0,   0,   0,   0,  13,   0,   0,   0,   0,
       0,   7,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   0,   0,  33,  21,   0,   0,   0,  43,   3,  47,
       0,   0,   0,   0,  30,  54,   0,   0,  38,   0,   0,   0,   1,
      62,   0,   0,  63,   0,  41,   0,   0,   0,   0,   0,   0,   0,
      61,   0,   0,   0,   0,  31,  55,  16,  34,  10,   0,   0,   0,
       0,   0,   0,   0,  11,  68,  75,   0,   8,   0, 100,  94,   0,
     103,   0,  83,   0,  71,   0,   0, 110,  27,  37,  69,  79,   0,
      35,  64,   0,   0,
  };
  static const unsigned char aLen[121] = {
       7,   7,   5,   4,   6,   4,   5,   3,   6,   7,   3,   6,   6,
       7,   7,   3,   8,   2,   6,   5,   4,   4,   3,  10,   4,   6,
      11,   6,   2,   7,   5,   5,   9,   6,   9,   9,   7,  10,  10,
       4,   6,   2,   3,   4,   9,   2,   6,   5,   6,   6,   5,   6,
       5,   5,   7,   7,   7,   2,   3,   4,   4,   7,   3,   6,   4,
       7,   6,  12,   6,   9,   4,   6,   5,   4,   7,   6,   5,   6,
       7,   5,   4,   5,   6,   5,   7,   3,   7,  13,   2,   2,   4,
       6,   6,   8,   5,  17,  12,   7,   8,   8,   2,   4,   4,   4,
       4,   4,   2,   2,   6,   5,   8,   5,   5,   8,   3,   5,   5,
       6,   4,   9,   3,
  };
  static const unsigned short int aOffset[121] = {
................................................................................
    TK_JOIN_KW,    TK_THEN,       TK_END,        TK_DEFERRABLE, TK_ELSE,       
    TK_EXCEPT,     TK_TRANSACTION,TK_ACTION,     TK_ON,         TK_JOIN_KW,    
    TK_ALTER,      TK_RAISE,      TK_EXCLUSIVE,  TK_EXISTS,     TK_SAVEPOINT,  
    TK_INTERSECT,  TK_TRIGGER,    TK_REFERENCES, TK_CONSTRAINT, TK_INTO,       
    TK_OFFSET,     TK_OF,         TK_SET,        TK_TEMP,       TK_TEMP,       
    TK_OR,         TK_UNIQUE,     TK_QUERY,      TK_ATTACH,     TK_HAVING,     
    TK_GROUP,      TK_UPDATE,     TK_BEGIN,      TK_JOIN_KW,    TK_RELEASE,    
    TK_BETWEEN,    TK_NOTNULL,    TK_NO,         TK_NOT,        TK_NULL,       
    TK_LIKE_KW,    TK_CASCADE,    TK_ASC,        TK_DELETE,     TK_CASE,       
    TK_COLLATE,    TK_CREATE,     TK_CTIME_KW,   TK_DETACH,     TK_IMMEDIATE,  
    TK_JOIN,       TK_INSERT,     TK_MATCH,      TK_PLAN,       TK_ANALYZE,    
    TK_PRAGMA,     TK_ABORT,      TK_VALUES,     TK_VIRTUAL,    TK_LIMIT,      
    TK_WHEN,       TK_WHERE,      TK_RENAME,     TK_AFTER,      TK_REPLACE,    
    TK_AND,        TK_DEFAULT,    TK_AUTOINCR,   TK_TO,         TK_IN,         
    TK_CAST,       TK_COLUMNKW,   TK_COMMIT,     TK_CONFLICT,   TK_JOIN_KW,    
................................................................................
      testcase( i==49 ); /* HAVING */
      testcase( i==50 ); /* GROUP */
      testcase( i==51 ); /* UPDATE */
      testcase( i==52 ); /* BEGIN */
      testcase( i==53 ); /* INNER */
      testcase( i==54 ); /* RELEASE */
      testcase( i==55 ); /* BETWEEN */
      testcase( i==56 ); /* NOTNULL */
      testcase( i==57 ); /* NO */
      testcase( i==58 ); /* NOT */
      testcase( i==59 ); /* NULL */
      testcase( i==60 ); /* LIKE */
      testcase( i==61 ); /* CASCADE */
      testcase( i==62 ); /* ASC */
      testcase( i==63 ); /* DELETE */
      testcase( i==64 ); /* CASE */
      testcase( i==65 ); /* COLLATE */
................................................................................
#endif
#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30
# error SQLITE_MAX_ATTACHED must be between 0 and 30
#endif
#if SQLITE_MAX_LIKE_PATTERN_LENGTH<1
# error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1
#endif
#if SQLITE_MAX_VARIABLE_NUMBER<1
# error SQLITE_MAX_VARIABLE_NUMBER must be at least 1
#endif
#if SQLITE_MAX_COLUMN>32767
# error SQLITE_MAX_COLUMN must not exceed 32767
#endif
#if SQLITE_MAX_TRIGGER_DEPTH<1
# error SQLITE_MAX_TRIGGER_DEPTH must be at least 1
#endif


|







 







|







 







|
|
|







 







|


<
<
<
<
<
<
<
<
<
<







 







>
>
>











|

>
>
>
>
>
>
|

|







 







|







 







>
>
>
>
>
>
>
>







 







>
>







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|
|


|
|
|
|
|
|







 







>
>

<
<
<







 







|
>







 







>







 







<







 







|







 







>







 







<
<
<







 







>







 







|
<
<







 







|


|






|


|







 







|





|







 







|







>

<
<
<
<
<
<
<
<
<

|




|







 







|











|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


|
|
|








|










|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|







 







|
>







 







|







 







<
<
<
<
<




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
<
<
>
>
|
<
<
>
>
>
>
>
|

|
>
>
>
>
>
>
>
>







 







|






|







 







|
|
|







 







|
|







 







|







 







|
>
|
<
>
>
|




|

|
|
|


|













|

|
|
<
<
<


<



>
>
>
>
>
>
>
>
>







 







>

>

|
<
<
>
>
>
>
>
>
>
>
|
>

|
>







 







|







 







|







 







|
|

|







 







|

|







 







|













|







 







>
>
|

<
>







 







|








|







 







>



|







 







|







 







|
|







 







<
>
>
>
>







 







<


<
<
<
<
<
<
<

<
>
>
>
>







 







|







 







>
>
>







 







>






|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







 







|







 







>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>







 







|
|
|
|
<
<







 







|







 







|







 







|







 







|







 







|







 







>







 







>
>
>
>
>







 







>
>
>
>
>
|
>













<





<


<

>
>
>
>
|
>
>
>
>
>

|







 







|







 







|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|




|







 







|




|







 







>
>







 







|







 







>
>
>


|






>

|







 







|







 







>












>
>
>
|
|
|
>
|
|
|
|
|
>







 







|

|










|







 







|










|







 







|
<







 







>







 







>







 







>







 







>







 







>











|


|







 







|







 







|











|







 







|







 







|
>
>
|
<
<
<
<
>
|
>
|
|


|
|
|
|
|
|
|
<
<

>
|
|
|

>
|
|
<
<
|
<
<
<
>
>
|
<
<
<
|
|
|
|
|
|

|







 







|
>
|
<
<
<







 







|
>
>




|
<
<







 







|
<









|







 







>
>
>
>
>
>







 







|




|
|







 







|













|







 







|



|







>
>








<
<
<
<

|
>
>


>

<
<
>


>
>
>
>
>
>
>


<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>





>

<
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
|







 







|
|
|
|







 







|
|
|
|
|
|
|
|
|
|
|



|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<


>
>



|



|



|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


|
|
|



|
|

|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|
|


|
|
|
|
|


|
|
|
|
|
|


|
|
|
|
|


|
|
|
|
|



|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|


|
|
|
|
|
|
|
|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


|
|




|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|


|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|







 







|


|


|


|


|







 







|
|






|











|







 







|







 







|
|
|







 







|
|







1
2
3
4
5
6
7
8
9
10
..
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
...
773
774
775
776
777
778
779
780
781
782










783
784
785
786
787
788
789
....
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
....
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
....
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
....
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
....
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
....
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
....
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550



7551
7552
7553
7554
7555
7556
7557
....
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
....
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
.....
10260
10261
10262
10263
10264
10265
10266

10267
10268
10269
10270
10271
10272
10273
.....
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
.....
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
.....
15712
15713
15714
15715
15716
15717
15718



15719
15720
15721
15722
15723
15724
15725
.....
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
.....
17896
17897
17898
17899
17900
17901
17902
17903


17904
17905
17906
17907
17908
17909
17910
.....
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
.....
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
.....
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386









18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
.....
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
.....
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
.....
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
.....
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
.....
28418
28419
28420
28421
28422
28423
28424





28425
28426
28427
28428
28429
28430
28431
28432
28433
28434
28435
28436
28437
28438
28439
28440
28441
28442
28443
28444
28445
28446
28447
28448
28449
28450
28451
28452
28453
28454
28455
28456
28457
28458


28459
28460
28461


28462
28463
28464
28465
28466
28467
28468
28469
28470
28471
28472
28473
28474
28475
28476
28477
28478
28479
28480
28481
28482
28483
28484
.....
28838
28839
28840
28841
28842
28843
28844
28845
28846
28847
28848
28849
28850
28851
28852
28853
28854
28855
28856
28857
28858
28859
.....
36704
36705
36706
36707
36708
36709
36710
36711
36712
36713
36714
36715
36716
36717
36718
36719
36720
.....
36984
36985
36986
36987
36988
36989
36990
36991
36992
36993
36994
36995
36996
36997
36998
36999
.....
37126
37127
37128
37129
37130
37131
37132
37133
37134
37135
37136
37137
37138
37139
37140
.....
37730
37731
37732
37733
37734
37735
37736
37737
37738
37739

37740
37741
37742
37743
37744
37745
37746
37747
37748
37749
37750
37751
37752
37753
37754
37755
37756
37757
37758
37759
37760
37761
37762
37763
37764
37765
37766
37767
37768
37769
37770
37771



37772
37773

37774
37775
37776
37777
37778
37779
37780
37781
37782
37783
37784
37785
37786
37787
37788
37789
37790
37791
37792
.....
37811
37812
37813
37814
37815
37816
37817
37818
37819
37820
37821
37822


37823
37824
37825
37826
37827
37828
37829
37830
37831
37832
37833
37834
37835
37836
37837
37838
37839
37840
37841
37842
.....
37847
37848
37849
37850
37851
37852
37853
37854
37855
37856
37857
37858
37859
37860
37861
.....
37868
37869
37870
37871
37872
37873
37874
37875
37876
37877
37878
37879
37880
37881
37882
.....
37914
37915
37916
37917
37918
37919
37920
37921
37922
37923
37924
37925
37926
37927
37928
37929
37930
37931
.....
37982
37983
37984
37985
37986
37987
37988
37989
37990
37991
37992
37993
37994
37995
37996
37997
37998
.....
38017
38018
38019
38020
38021
38022
38023
38024
38025
38026
38027
38028
38029
38030
38031
38032
38033
38034
38035
38036
38037
38038
38039
38040
38041
38042
38043
38044
38045
.....
38052
38053
38054
38055
38056
38057
38058
38059
38060
38061
38062

38063
38064
38065
38066
38067
38068
38069
38070
.....
38087
38088
38089
38090
38091
38092
38093
38094
38095
38096
38097
38098
38099
38100
38101
38102
38103
38104
38105
38106
38107
38108
38109
38110
.....
38114
38115
38116
38117
38118
38119
38120
38121
38122
38123
38124
38125
38126
38127
38128
38129
38130
38131
38132
.....
38151
38152
38153
38154
38155
38156
38157
38158
38159
38160
38161
38162
38163
38164
38165
.....
38247
38248
38249
38250
38251
38252
38253
38254
38255
38256
38257
38258
38259
38260
38261
38262
.....
38653
38654
38655
38656
38657
38658
38659

38660
38661
38662
38663
38664
38665
38666
38667
38668
38669
38670
.....
40628
40629
40630
40631
40632
40633
40634

40635
40636







40637

40638
40639
40640
40641
40642
40643
40644
40645
40646
40647
40648
.....
44094
44095
44096
44097
44098
44099
44100
44101
44102
44103
44104
44105
44106
44107
44108
.....
47150
47151
47152
47153
47154
47155
47156
47157
47158
47159
47160
47161
47162
47163
47164
47165
47166
.....
47257
47258
47259
47260
47261
47262
47263
47264
47265
47266
47267
47268
47269
47270
47271
47272
47273
47274
47275
47276
47277
47278
.....
48218
48219
48220
48221
48222
48223
48224





















48225
48226
48227
48228
48229
48230
48231
.....
50206
50207
50208
50209
50210
50211
50212
50213
50214
50215
50216
50217
50218
50219
50220
50221
50222
50223
50224
50225
50226
50227
50228
50229
50230
50231
50232
50233
50234
50235
50236
50237
50238
50239
50240
50241
50242
50243
50244
50245
50246
50247
50248
50249
50250
50251
50252
50253
50254
50255
50256
50257
50258
.....
50346
50347
50348
50349
50350
50351
50352
50353
50354
50355
50356
50357
50358
50359
50360
50361
50362
.....
50555
50556
50557
50558
50559
50560
50561
50562
50563
50564
50565
50566
50567
50568
50569
.....
51165
51166
51167
51168
51169
51170
51171
51172
51173
51174
51175
51176
51177
51178
51179
51180
51181
51182
51183
51184
51185
51186
51187
.....
51423
51424
51425
51426
51427
51428
51429
51430
51431
51432
51433
51434
51435
51436
51437
51438
51439
51440
51441
51442
.....
51625
51626
51627
51628
51629
51630
51631
51632
51633
51634
51635


51636
51637
51638
51639
51640
51641
51642
.....
51799
51800
51801
51802
51803
51804
51805
51806
51807
51808
51809
51810
51811
51812
51813
.....
52348
52349
52350
52351
52352
52353
52354
52355
52356
52357
52358
52359
52360
52361
52362
.....
52992
52993
52994
52995
52996
52997
52998
52999
53000
53001
53002
53003
53004
53005
53006
.....
53143
53144
53145
53146
53147
53148
53149
53150
53151
53152
53153
53154
53155
53156
53157
.....
53368
53369
53370
53371
53372
53373
53374
53375
53376
53377
53378
53379
53380
53381
53382
.....
54864
54865
54866
54867
54868
54869
54870
54871
54872
54873
54874
54875
54876
54877
54878
.....
54985
54986
54987
54988
54989
54990
54991
54992
54993
54994
54995
54996
54997
54998
54999
55000
55001
55002
55003
.....
55789
55790
55791
55792
55793
55794
55795
55796
55797
55798
55799
55800
55801
55802
55803
55804
55805
55806
55807
55808
55809
55810
55811
55812
55813
55814
55815

55816
55817
55818
55819
55820

55821
55822

55823
55824
55825
55826
55827
55828
55829
55830
55831
55832
55833
55834
55835
55836
55837
55838
55839
55840
55841
55842
.....
57146
57147
57148
57149
57150
57151
57152
57153
57154
57155
57156
57157
57158
57159
57160
.....
57444
57445
57446
57447
57448
57449
57450
57451
57452
57453
57454
57455
57456
57457
57458
.....
57656
57657
57658
57659
57660
57661
57662
57663
57664
57665
57666
57667
57668
57669
57670
.....
59277
59278
59279
59280
59281
59282
59283
59284
59285
59286
59287
59288
59289
59290
59291
59292
59293
59294
59295
59296
59297
59298
59299
59300
59301
59302
59303
59304
59305
59306
59307
59308
59309
59310
59311
.....
60646
60647
60648
60649
60650
60651
60652
60653
60654
60655
60656
60657
60658
60659
60660
60661
60662
60663
60664
60665
.....
60675
60676
60677
60678
60679
60680
60681
60682
60683
60684
60685
60686
60687
60688
60689
60690
60691
60692
60693
60694
.....
61446
61447
61448
61449
61450
61451
61452
61453
61454
61455
61456
61457
61458
61459
61460
61461
.....
61526
61527
61528
61529
61530
61531
61532
61533
61534
61535
61536
61537
61538
61539
61540
.....
61573
61574
61575
61576
61577
61578
61579
61580
61581
61582
61583
61584
61585
61586
61587
61588
61589
61590
61591
61592
61593
61594
61595
61596
61597
61598
61599
61600
61601
.....
61652
61653
61654
61655
61656
61657
61658
61659
61660
61661
61662
61663
61664
61665
61666
.....
61683
61684
61685
61686
61687
61688
61689
61690
61691
61692
61693
61694
61695
61696
61697
61698
61699
61700
61701
61702
61703
61704
61705
61706
61707
61708
61709
61710
61711
61712
61713
61714
61715
61716
61717
61718
61719
61720
61721
61722
.....
61752
61753
61754
61755
61756
61757
61758
61759
61760
61761
61762
61763
61764
61765
61766
61767
61768
61769
61770
61771
61772
61773
61774
61775
61776
61777
61778
61779
.....
62251
62252
62253
62254
62255
62256
62257
62258
62259
62260
62261
62262
62263
62264
62265
62266
62267
62268
62269
62270
62271
62272
62273
62274
62275
62276
.....
62522
62523
62524
62525
62526
62527
62528
62529

62530
62531
62532
62533
62534
62535
62536
.....
62887
62888
62889
62890
62891
62892
62893
62894
62895
62896
62897
62898
62899
62900
62901
.....
62961
62962
62963
62964
62965
62966
62967
62968
62969
62970
62971
62972
62973
62974
62975
.....
78322
78323
78324
78325
78326
78327
78328
78329
78330
78331
78332
78333
78334
78335
78336
.....
78337
78338
78339
78340
78341
78342
78343
78344
78345
78346
78347
78348
78349
78350
78351
.....
78495
78496
78497
78498
78499
78500
78501
78502
78503
78504
78505
78506
78507
78508
78509
78510
78511
78512
78513
78514
78515
78516
78517
78518
78519
78520
78521
78522
78523
78524
.....
78536
78537
78538
78539
78540
78541
78542
78543
78544
78545
78546
78547
78548
78549
78550
.....
78570
78571
78572
78573
78574
78575
78576
78577
78578
78579
78580
78581
78582
78583
78584
78585
78586
78587
78588
78589
78590
78591
78592
78593
78594
78595
78596
.....
78616
78617
78618
78619
78620
78621
78622
78623
78624
78625
78626
78627
78628
78629
78630
.....
78864
78865
78866
78867
78868
78869
78870
78871
78872
78873
78874




78875
78876
78877
78878
78879
78880
78881
78882
78883
78884
78885
78886
78887
78888


78889
78890
78891
78892
78893
78894
78895
78896
78897


78898



78899
78900
78901



78902
78903
78904
78905
78906
78907
78908
78909
78910
78911
78912
78913
78914
78915
78916
.....
78984
78985
78986
78987
78988
78989
78990
78991
78992
78993



78994
78995
78996
78997
78998
78999
79000
.....
79019
79020
79021
79022
79023
79024
79025
79026
79027
79028
79029
79030
79031
79032
79033


79034
79035
79036
79037
79038
79039
79040
.....
84767
84768
84769
84770
84771
84772
84773
84774

84775
84776
84777
84778
84779
84780
84781
84782
84783
84784
84785
84786
84787
84788
84789
84790
84791
.....
84947
84948
84949
84950
84951
84952
84953
84954
84955
84956
84957
84958
84959
84960
84961
84962
84963
84964
84965
84966
.....
85007
85008
85009
85010
85011
85012
85013
85014
85015
85016
85017
85018
85019
85020
85021
85022
85023
85024
85025
85026
85027
.....
85029
85030
85031
85032
85033
85034
85035
85036
85037
85038
85039
85040
85041
85042
85043
85044
85045
85046
85047
85048
85049
85050
85051
85052
85053
85054
85055
85056
85057
.....
86717
86718
86719
86720
86721
86722
86723
86724
86725
86726
86727
86728
86729
86730
86731
86732
86733
86734
86735
86736
86737
86738
86739
86740
86741
86742
86743
86744
86745




86746
86747
86748
86749
86750
86751
86752
86753


86754
86755
86756
86757
86758
86759
86760
86761
86762
86763
86764
86765

86766
86767
86768
86769
86770
86771
86772
86773
86774
86775
86776
86777
86778
86779
86780
86781

86782
86783
86784
86785
86786
86787
86788
86789
86790

86791
86792
86793
86794
86795
86796
86797
86798
86799
86800
86801
86802
86803
86804
86805
86806
86807
86808
86809
86810
86811
86812
86813
86814
86815
86816
86817
86818
86819
86820
86821
86822
86823
.....
87190
87191
87192
87193
87194
87195
87196
87197
87198
87199
87200
87201
87202
87203
87204
87205
87206
87207
.....
87328
87329
87330
87331
87332
87333
87334
87335
87336
87337
87338
87339
87340
87341
87342
87343
87344
87345
87346
87347
87348
87349
87350
87351
87352
87353
87354
87355
87356
.....
88120
88121
88122
88123
88124
88125
88126
88127
88128
88129
88130
88131
88132
88133
88134
88135
88136
88137
88138
88139
88140
88141
88142
88143
88144
88145
88146
88147
88148
88149
88150
88151
88152
88153
88154
88155
88156
88157
88158
88159
88160
88161
88162
88163
88164
88165
88166
88167
88168
88169
.....
88208
88209
88210
88211
88212
88213
88214



88215
88216
88217
88218
88219
88220
88221
88222
88223
88224
88225
88226
88227
88228
88229
88230
88231
88232
88233
88234
88235
88236
88237
.....
90393
90394
90395
90396
90397
90398
90399
90400
90401
90402
90403
90404
90405
90406
90407
90408
90409
90410
90411
90412
90413
90414
90415
90416
90417
90418
90419
90420
90421
90422
90423
90424
90425
90426
90427
90428
90429
90430
90431
90432
90433
90434
90435
90436
90437
90438
90439
90440
90441
90442
90443
90444
90445
90446
90447
90448
90449
90450
90451
90452
90453
90454
90455
90456
90457
90458
90459
90460
90461
90462
90463
90464
90465
90466
90467
90468
90469
90470
90471
90472
90473
90474
90475
90476
90477
90478
90479
90480
90481
90482
90483
90484
90485
90486
90487
90488
90489
90490
90491
90492
90493
90494
90495
90496
90497
90498
90499
90500
90501
90502
90503
90504
90505
90506
90507
90508
90509
90510
90511
90512
90513
90514
90515
90516
90517
90518
90519
90520
90521
90522
90523
90524
90525
90526
90527
90528
90529
90530
90531
90532
90533
90534
90535
90536
90537
90538
90539
90540
90541
90542
90543
90544
90545
90546
90547
90548
90549
90550
90551
90552
90553
90554
90555
90556
90557
90558
90559
90560
90561
90562
90563
90564
90565
90566
90567
90568
90569
90570
90571
90572
90573
90574
90575
90576
90577
90578
90579
90580
90581
90582
90583
90584
90585
90586
90587
90588
90589
90590
90591
90592
90593
90594
90595
90596
90597
90598
90599
90600
90601
90602
90603
90604
90605
90606
90607
90608
90609
90610
90611
90612
90613
90614
90615
90616
90617
90618
90619
90620
90621
90622
90623
90624
90625
90626
90627
90628
90629
90630
90631
90632
90633
90634
90635
90636
90637
90638
90639
90640
90641
90642
90643
90644
90645
90646
90647
90648
90649
90650
90651
90652
90653
90654
90655
90656
90657
90658
90659
90660
90661
90662
90663
90664
90665
90666
90667
90668
90669
90670
90671
90672
90673
90674
90675
90676
90677
90678
90679
90680
90681
90682
90683
90684
90685
90686
90687
90688
90689
90690
90691
90692
90693
90694
90695
90696
90697
90698
90699
90700
90701
90702
90703
90704
90705
90706
90707
90708
90709
90710
90711
90712
90713
90714
90715
90716
90717
90718
90719
90720
90721
90722
90723
90724
90725
90726
90727
90728
90729
90730
90731
90732
90733
90734
90735
90736
90737
90738
90739
90740
90741
90742
90743
90744
90745
90746
90747
90748
90749
90750
90751
90752
90753
90754
90755
90756
90757
90758
90759
90760
90761
90762
90763
90764
90765
90766
90767
90768
90769
90770
90771
90772
90773
90774
90775
90776
90777
90778
90779
90780
90781
90782
90783
90784
90785
90786
90787
90788
90789
90790
90791
90792
90793
90794
90795
90796
90797
90798
90799
90800
90801
90802
90803
90804
90805
90806
90807
90808
90809
90810
90811
90812
90813
90814
90815
90816
90817
90818
90819
90820
90821
90822
90823
90824
90825
90826
90827
90828
90829
90830
90831
90832
90833
90834
90835
90836
90837
90838
90839
90840
90841
90842
90843
90844
90845
90846
90847
90848
90849
90850
90851
90852
90853
90854
90855
90856
90857
90858
90859
90860
90861
90862
90863
90864
90865
.....
92367
92368
92369
92370
92371
92372
92373
92374
92375
92376
92377
92378
92379
92380
92381
.....
92382
92383
92384
92385
92386
92387
92388
92389
92390
92391
92392
92393
92394
92395
92396
92397
92398
92399
92400
92401
92402
92403
92404
92405
92406
92407
92408
.....
93647
93648
93649
93650
93651
93652
93653
93654
93655
93656
93657
93658
93659
93660
93661
93662
93663
93664
93665
93666
93667
93668
93669
93670
93671
93672
93673
93674
93675
93676
93677
93678
93679
93680
93681
.....
93698
93699
93700
93701
93702
93703
93704
93705
93706
93707
93708
93709
93710
93711
93712
.....
93776
93777
93778
93779
93780
93781
93782
93783
93784
93785
93786
93787
93788
93789
93790
93791
93792
.....
96172
96173
96174
96175
96176
96177
96178
96179
96180
96181
96182
96183
96184
96185
96186
96187
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.6.20.  By combining all the individual C code files into this 
** single large file, the entire code can be compiled as a one translation
** unit.  This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately.  Performance improvements
** of 5% are more are commonly seen when SQLite is compiled as a single
** translation unit.
**
** This file is all you need to compile SQLite.  To use SQLite in other
................................................................................
** the "sqlite3.h" header file at hand, you will find a copy embedded within
** the text of this file.  Search for "Begin file sqlite3.h" to find the start
** of the embedded sqlite3.h header file.) Additional code files may be needed
** if you want a wrapper to interface SQLite with your choice of programming
** language. The code for the "sqlite3" command-line shell is also in a
** separate file. This file contains only code for the core SQLite library.
**
** This amalgamation was generated on 2009-11-01 19:22:03 UTC.
*/
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
#ifndef SQLITE_PRIVATE
# define SQLITE_PRIVATE static
#endif
#ifndef SQLITE_API
................................................................................
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION        "3.6.20"
#define SQLITE_VERSION_NUMBER 3006020
#define SQLITE_SOURCE_ID      "2009-10-30 14:27:15 612952743da28e651512547fc0d3925f4c698eb4"

/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
................................................................................
#endif

/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
** Applications must [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** the [sqlite3] object prior to attempting to close the object.










**
** If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
................................................................................

/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library.  The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().
** This routines are designed to aid in process initialization and
** shutdown on embedded systems.  Workstation applications using
** SQLite normally do not need to invoke either of these routines.
**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown().  Only an effective call
** of sqlite3_initialize() does any initialization.  All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
** an effective call to sqlite3_shutdown() does any deinitialization.
** All other valid calls to sqlite3_shutdown() are harmless no-ops.
**
** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
** is not.  The sqlite3_shutdown() interface must only be called from a
** single thread.  All open [database connections] must be closed and all
** other SQLite resources must be deallocated prior to invoking
** sqlite3_shutdown().
**
** Among other things, sqlite3_initialize() will invoke
** sqlite3_os_init().  Similarly, sqlite3_shutdown()
** will invoke sqlite3_os_end().
**
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
** If for some reason, sqlite3_initialize() is unable to initialize
** the library (perhaps it is unable to allocate a needed resource such
** as a mutex) it returns an [error code] other than [SQLITE_OK].
**
** The sqlite3_initialize() routine is called internally by many other
................................................................................
**
** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
** recommended for all new programs. The two older interfaces are retained
** for backwards compatibility, but their use is discouraged.
** In the "v2" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave a differently in three ways:
**
** <ol>
** <li>
** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
** always used to do, [sqlite3_step()] will automatically recompile the SQL
** statement and try to run it again.  If the schema has changed in
** a way that makes the statement no longer valid, [sqlite3_step()] will still
................................................................................
** When an error occurs, [sqlite3_step()] will return one of the detailed
** [error codes] or [extended error codes].  The legacy behavior was that
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and you would have to make a second call to [sqlite3_reset()] in order
** to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>
**
** <li>
** ^If the value of a [parameter | host parameter] in the WHERE clause might
** change the query plan for a statement, then the statement may be
** automatically recompiled (as if there had been a schema change) on the first 
** [sqlite3_step()] call following any change to the 
** [sqlite3_bind_text | bindings] of the [parameter]. 
** </li>
** </ol>
**
** Requirements:
** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021]
**
*/
SQLITE_API int sqlite3_prepare(
................................................................................
**
** These routines return information about a single column of the current
** result row of a query.  In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
** that was returned from [sqlite3_prepare_v2()] or one of its variants)
** and the second argument is the index of the column for which information
** should be returned.  The leftmost column of the result set has the index 0.
** The number of columns in the result can be determined using
** [sqlite3_column_count()].
**
** If the SQL statement does not currently point to a valid row, or if the
** column index is out of range, the result is undefined.
** These routines may only be called when the most recent call to
** [sqlite3_step()] has returned [SQLITE_ROW] and neither
** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
** If any of these routines are called after [sqlite3_reset()] or
................................................................................
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
** header file that defines a number for each opcode used by the VDBE.
*/
/************** Include opcodes.h in the middle of vdbe.h ********************/
/************** Begin file opcodes.h *****************************************/
/* Automatically generated.  Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_ReadCookie                           1
#define OP_AutoCommit                           2
#define OP_Found                                3
#define OP_NullRow                              4
#define OP_Lt                                  79   /* same as TK_LT       */
#define OP_RowSetTest                           5
#define OP_Variable                             6
#define OP_RealAffinity                         7
#define OP_Sort                                 8
#define OP_Affinity                             9
#define OP_IfNot                               10
#define OP_Gosub                               11
#define OP_Add                                 86   /* same as TK_PLUS     */
#define OP_NotFound                            12
#define OP_ResultRow                           13
#define OP_IsNull                              73   /* same as TK_ISNULL   */
#define OP_SeekLe                              14
#define OP_Rowid                               15
#define OP_CreateIndex                         16
#define OP_Explain                             17
#define OP_DropIndex                           18
#define OP_Null                                20
#define OP_Program                             21
#define OP_ToInt                              144   /* same as TK_TO_INT   */
#define OP_Int64                               22
#define OP_LoadAnalysis                        23
#define OP_IdxInsert                           24
#define OP_VUpdate                             25
#define OP_Next                                26
#define OP_ToNumeric                          143   /* same as TK_TO_NUMERIC*/
#define OP_Ge                                  80   /* same as TK_GE       */
#define OP_BitNot                              93   /* same as TK_BITNOT   */
#define OP_SeekLt                              27
#define OP_Rewind                              28
#define OP_Multiply                            88   /* same as TK_STAR     */
#define OP_ToReal                             145   /* same as TK_TO_REAL  */
#define OP_Gt                                  77   /* same as TK_GT       */
#define OP_RowSetRead                          29
#define OP_Last                                30
#define OP_MustBeInt                           31
#define OP_Ne                                  75   /* same as TK_NE       */
#define OP_IncrVacuum                          32
#define OP_String                              33
#define OP_VFilter                             34
#define OP_Count                               35
#define OP_Close                               36
#define OP_AggFinal                            37
#define OP_RowData                             38
#define OP_IdxRowid                            39
#define OP_Param                               40
#define OP_Pagecount                           41
#define OP_BitOr                               83   /* same as TK_BITOR    */
#define OP_NotNull                             74   /* same as TK_NOTNULL  */
#define OP_SeekGe                              42
#define OP_Not                                 19   /* same as TK_NOT      */
#define OP_OpenPseudo                          43
#define OP_Halt                                44
#define OP_Compare                             45
#define OP_NewRowid                            46
#define OP_Real                               130   /* same as TK_FLOAT    */
#define OP_IdxLT                               47
#define OP_SeekGt                              48
#define OP_MemMax                              49
#define OP_Function                            50
#define OP_IntegrityCk                         51
#define OP_Remainder                           90   /* same as TK_REM      */
#define OP_FkCounter                           52
#define OP_SCopy                               53
#define OP_ShiftLeft                           84   /* same as TK_LSHIFT   */
#define OP_IfNeg                               54
#define OP_BitAnd                              82   /* same as TK_BITAND   */
#define OP_Or                                  68   /* same as TK_OR       */
#define OP_NotExists                           55
#define OP_VDestroy                            56
#define OP_IdxDelete                           57
#define OP_Vacuum                              58
#define OP_Copy                                59
#define OP_If                                  60
#define OP_Jump                                61
#define OP_Destroy                             62
#define OP_AggStep                             63
#define OP_Clear                               64
#define OP_Insert                              65
#define OP_Permutation                         66
#define OP_VBegin                              67
#define OP_OpenEphemeral                       70
#define OP_IdxGE                               71
#define OP_Trace                               72
#define OP_Divide                              89   /* same as TK_SLASH    */
#define OP_String8                             94   /* same as TK_STRING   */
#define OP_Concat                              91   /* same as TK_CONCAT   */
#define OP_MakeRecord                          81
#define OP_Yield                               92
#define OP_SetCookie                           95
#define OP_Prev                                96
#define OP_DropTrigger                         97
#define OP_FkIfZero                            98
#define OP_And                                 69   /* same as TK_AND      */
#define OP_VColumn                             99
#define OP_Return                             100
#define OP_OpenWrite                          101
#define OP_Integer                            102
#define OP_Transaction                        103
#define OP_IfPos                              104
#define OP_RowSetAdd                          105
#define OP_CollSeq                            106
#define OP_Savepoint                          107
#define OP_VRename                            108
#define OP_ToBlob                             142   /* same as TK_TO_BLOB  */
#define OP_Sequence                           109
#define OP_ShiftRight                          85   /* same as TK_RSHIFT   */
#define OP_HaltIfNull                         110
#define OP_VCreate                            111
#define OP_CreateTable                        112
#define OP_AddImm                             113
#define OP_ToText                             141   /* same as TK_TO_TEXT  */
#define OP_DropTable                          114
#define OP_IsUnique                           115
#define OP_VOpen                              116
#define OP_IfZero                             117
#define OP_Noop                               118
#define OP_InsertInt                          119
#define OP_RowKey                             120
#define OP_Expire                             121
#define OP_Delete                             122
#define OP_Subtract                            87   /* same as TK_MINUS    */
#define OP_Blob                               123
#define OP_Move                               124
#define OP_Goto                               125
#define OP_ParseSchema                        126
#define OP_Eq                                  76   /* same as TK_EQ       */
#define OP_VNext                              127
#define OP_Seek                               128
#define OP_Le                                  78   /* same as TK_LE       */
#define OP_TableLock                          129
#define OP_VerifyCookie                       131
#define OP_Column                             132
#define OP_OpenRead                           133
#define OP_ResetCount                         134

/* The following opcode values are never used */
#define OP_NotUsed_135                        135
#define OP_NotUsed_136                        136
#define OP_NotUsed_137                        137
#define OP_NotUsed_138                        138
#define OP_NotUsed_139                        139
#define OP_NotUsed_140                        140

................................................................................
#define OPFLG_JUMP            0x0001  /* jump:  P2 holds jmp target */
#define OPFLG_OUT2_PRERELEASE 0x0002  /* out2-prerelease: */
#define OPFLG_IN1             0x0004  /* in1:   P1 is an input */
#define OPFLG_IN2             0x0008  /* in2:   P2 is an input */
#define OPFLG_IN3             0x0010  /* in3:   P3 is an input */
#define OPFLG_OUT3            0x0020  /* out3:  P3 is an output */
#define OPFLG_INITIALIZER {\
/*   0 */ 0x00, 0x02, 0x00, 0x11, 0x00, 0x15, 0x00, 0x04,\
/*   8 */ 0x01, 0x00, 0x05, 0x01, 0x11, 0x00, 0x11, 0x02,\
/*  16 */ 0x02, 0x00, 0x00, 0x04, 0x02, 0x01, 0x02, 0x00,\
/*  24 */ 0x08, 0x00, 0x01, 0x11, 0x01, 0x21, 0x01, 0x05,\
/*  32 */ 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02,\
/*  40 */ 0x02, 0x02, 0x11, 0x00, 0x00, 0x00, 0x02, 0x11,\
/*  48 */ 0x11, 0x08, 0x00, 0x00, 0x00, 0x04, 0x05, 0x11,\
/*  56 */ 0x00, 0x00, 0x00, 0x04, 0x05, 0x01, 0x02, 0x00,\
/*  64 */ 0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x00, 0x11,\
/*  72 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
/*  80 */ 0x15, 0x00, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,\
/*  88 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x04, 0x04, 0x02, 0x10,\
/*  96 */ 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00,\
/* 104 */ 0x05, 0x08, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00,\
/* 112 */ 0x02, 0x04, 0x00, 0x11, 0x00, 0x05, 0x00, 0x00,\
/* 120 */ 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01,\
/* 128 */ 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
/* 144 */ 0x04, 0x04,}

/************** End of opcodes.h *********************************************/
/************** Continuing where we left off in vdbe.h ***********************/

/*
................................................................................
SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);
SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);
SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
SQLITE_PRIVATE void sqlite3VdbeProgramDelete(sqlite3 *, SubProgram *, int);
SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe*, int, u8);
SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);




SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int);
SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);


#ifndef NDEBUG
SQLITE_PRIVATE   void sqlite3VdbeComment(Vdbe*, const char*, ...);
................................................................................
  ** space is allocated for the fields below this point. An attempt to
  ** access them will result in a segfault or malfunction.
  *********************************************************************/

  int iTable;            /* TK_COLUMN: cursor number of table holding column
                         ** TK_REGISTER: register number
                         ** TK_TRIGGER: 1 -> new, 0 -> old */
  i16 iColumn;           /* TK_COLUMN: column index.  -1 for rowid.
                         ** TK_VARIABLE: variable number (always >= 1). */
  i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
  i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
  u8 flags2;             /* Second set of flags.  EP2_... */
  u8 op2;                /* If a TK_REGISTER, the original value of Expr.op */
  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
  Table *pTab;           /* Table for TK_COLUMN expressions. */
#if SQLITE_MAX_EXPR_DEPTH>0
................................................................................
  /* Above is constant between recursions.  Below is reset before and after
  ** each recursion */

  int nVar;            /* Number of '?' variables seen in the SQL so far */
  int nVarExpr;        /* Number of used slots in apVarExpr[] */
  int nVarExprAlloc;   /* Number of allocated slots in apVarExpr[] */
  Expr **apVarExpr;    /* Pointers to :aaa and $aaaa wildcard expressions */
  Vdbe *pReprepare;    /* VM being reprepared (sqlite3Reprepare()) */
  int nAlias;          /* Number of aliased result set columns */
  int nAliasAlloc;     /* Number of allocated slots for aAlias[] */
  int *aAlias;         /* Register used to hold aliased result */
  u8 explain;          /* True if the EXPLAIN flag is found on the query */
  Token sNameToken;    /* Token with unqualified schema object name */
  Token sLastToken;    /* The last token parsed */
  const char *zTail;   /* All SQL text past the last semicolon parsed */
................................................................................
SQLITE_PRIVATE void sqlite3Vacuum(Parse*);
SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*);
SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);

SQLITE_PRIVATE void sqlite3PrngSaveState(void);
SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
SQLITE_PRIVATE void sqlite3PrngResetState(void);
SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*);
SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);
................................................................................
SQLITE_PRIVATE void sqlite3RootPageMoved(Db*, int, int);
SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*);
SQLITE_PRIVATE void sqlite3AlterFunctions(sqlite3*);
SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*);
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int);
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
................................................................................
SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);

SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int);
SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int);
SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*);
SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);

SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);

/*
** The interface to the LEMON-generated parser
*/
................................................................................
** Attempt to release up to n bytes of non-essential memory currently
** held by SQLite. An example of non-essential memory is memory used to
** cache database pages that are not currently in use.
*/
SQLITE_API int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  int nRet = 0;



  nRet += sqlite3PcacheReleaseMemory(n-nRet);
  return nRet;
#else
  UNUSED_PARAMETER(n);
  return SQLITE_OK;
#endif
}
................................................................................
  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */
  int iStatement;         /* Statement number (or 0 if has not opened stmt) */
#ifdef SQLITE_DEBUG
  FILE *trace;            /* Write an execution trace here, if not NULL */
#endif
  VdbeFrame *pFrame;      /* Parent frame */
  int nFrame;             /* Number of frames in pFrame list */
  u32 expmask;            /* Binding to these vars invalidates VM */
};

/*
** The following are allowed values for Vdbe.magic
*/
#define VDBE_MAGIC_INIT     0x26bceaa5    /* Building a VDBE program */
#define VDBE_MAGIC_RUN      0xbdf20da3    /* VDBE is ready to execute */
................................................................................
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int, int);
SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*);
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);
SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);



#ifndef SQLITE_OMIT_FOREIGN_KEY
SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
#else
# define sqlite3VdbeCheckFk(p,i) 0
#endif

................................................................................
    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \
    *zOut++ = (u8)(c&0x00FF);                                       \
  }                                                                 \
}

#define READ_UTF16LE(zIn, TERM, c){                                   \
  c = (*zIn++);                                                       \
  c += ((*zIn++)<<8);                                                 \
  if( c>=0xD800 && c<0xE000 && TERM ){                                \
    int c2 = (*zIn++);                                                \
    c2 += ((*zIn++)<<8);                                              \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

#define READ_UTF16BE(zIn, TERM, c){                                   \
  c = ((*zIn++)<<8);                                                  \
  c += (*zIn++);                                                      \
  if( c>=0xD800 && c<0xE000 && TERM ){                                \
    int c2 = ((*zIn++)<<8);                                           \
    c2 += (*zIn++);                                                   \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

/*
................................................................................
    pMem->n = (int)(z - zOut);
    *z++ = 0;
  }else{
    assert( desiredEnc==SQLITE_UTF8 );
    if( pMem->enc==SQLITE_UTF16LE ){
      /* UTF-16 Little-endian -> UTF-8 */
      while( zIn<zTerm ){
        READ_UTF16LE(zIn, zIn<zTerm, c); 
        WRITE_UTF8(z, c);
      }
    }else{
      /* UTF-16 Big-endian -> UTF-8 */
      while( zIn<zTerm ){
        READ_UTF16BE(zIn, zIn<zTerm, c); 
        WRITE_UTF8(z, c);
      }
    }
    pMem->n = (int)(z - zOut);
  }
  *z = 0;
  assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
................................................................................
  assert( m.z==m.zMalloc );
  *pnOut = m.n;
  return m.z;
}
#endif

/*
** zIn is a UTF-16 encoded unicode string at least nChar characters long.
** Return the number of bytes in the first nChar unicode characters
** in pZ.  nChar must be non-negative.
*/
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  int c;
  unsigned char const *z = zIn;
  int n = 0;
  
  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){









    while( n<nChar ){
      READ_UTF16BE(z, 1, c);
      n++;
    }
  }else{
    while( n<nChar ){
      READ_UTF16LE(z, 1, c);
      n++;
    }
  }
  return (int)(z-(unsigned char const *)zIn);
}

#if defined(SQLITE_TEST)
................................................................................
    if( i>=0xD800 && i<0xE000 ) continue;
    z = zBuf;
    WRITE_UTF16LE(z, i);
    n = (int)(z-zBuf);
    assert( n>0 && n<=4 );
    z[0] = 0;
    z = zBuf;
    READ_UTF16LE(z, 1, c);
    assert( c==i );
    assert( (z-zBuf)==n );
  }
  for(i=0; i<0x00110000; i++){
    if( i>=0xD800 && i<0xE000 ) continue;
    z = zBuf;
    WRITE_UTF16BE(z, i);
    n = (int)(z-zBuf);
    assert( n>0 && n<=4 );
    z[0] = 0;
    z = zBuf;
    READ_UTF16BE(z, 1, c);
    assert( c==i );
    assert( (z-zBuf)==n );
  }
}
#endif /* SQLITE_TEST */
#endif /* SQLITE_OMIT_UTF16 */

................................................................................
/************** End of hash.c ************************************************/
/************** Begin file opcodes.c *****************************************/
/* Automatically generated.  Do not edit */
/* See the mkopcodec.awk script for details. */
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
 static const char *const azName[] = { "?",
     /*   1 */ "ReadCookie",
     /*   2 */ "AutoCommit",
     /*   3 */ "Found",
     /*   4 */ "NullRow",
     /*   5 */ "RowSetTest",
     /*   6 */ "Variable",
     /*   7 */ "RealAffinity",
     /*   8 */ "Sort",
     /*   9 */ "Affinity",
     /*  10 */ "IfNot",
     /*  11 */ "Gosub",
     /*  12 */ "NotFound",
     /*  13 */ "ResultRow",
     /*  14 */ "SeekLe",
     /*  15 */ "Rowid",
     /*  16 */ "CreateIndex",
     /*  17 */ "Explain",
     /*  18 */ "DropIndex",
     /*  19 */ "Not",
     /*  20 */ "Null",
     /*  21 */ "Program",
     /*  22 */ "Int64",
     /*  23 */ "LoadAnalysis",
     /*  24 */ "IdxInsert",
     /*  25 */ "VUpdate",
     /*  26 */ "Next",
     /*  27 */ "SeekLt",
     /*  28 */ "Rewind",
     /*  29 */ "RowSetRead",
     /*  30 */ "Last",
     /*  31 */ "MustBeInt",
     /*  32 */ "IncrVacuum",
     /*  33 */ "String",
     /*  34 */ "VFilter",
     /*  35 */ "Count",
     /*  36 */ "Close",
     /*  37 */ "AggFinal",
     /*  38 */ "RowData",
     /*  39 */ "IdxRowid",
     /*  40 */ "Param",
     /*  41 */ "Pagecount",
     /*  42 */ "SeekGe",
     /*  43 */ "OpenPseudo",
     /*  44 */ "Halt",
     /*  45 */ "Compare",
     /*  46 */ "NewRowid",
     /*  47 */ "IdxLT",
     /*  48 */ "SeekGt",
     /*  49 */ "MemMax",
     /*  50 */ "Function",
     /*  51 */ "IntegrityCk",
     /*  52 */ "FkCounter",
     /*  53 */ "SCopy",
     /*  54 */ "IfNeg",
     /*  55 */ "NotExists",
     /*  56 */ "VDestroy",
     /*  57 */ "IdxDelete",
     /*  58 */ "Vacuum",
     /*  59 */ "Copy",
     /*  60 */ "If",
     /*  61 */ "Jump",
     /*  62 */ "Destroy",
     /*  63 */ "AggStep",
     /*  64 */ "Clear",
     /*  65 */ "Insert",
     /*  66 */ "Permutation",
     /*  67 */ "VBegin",
     /*  68 */ "Or",
     /*  69 */ "And",
     /*  70 */ "OpenEphemeral",
     /*  71 */ "IdxGE",
     /*  72 */ "Trace",
     /*  73 */ "IsNull",
     /*  74 */ "NotNull",
     /*  75 */ "Ne",
     /*  76 */ "Eq",
     /*  77 */ "Gt",
     /*  78 */ "Le",
     /*  79 */ "Lt",
     /*  80 */ "Ge",
     /*  81 */ "MakeRecord",
     /*  82 */ "BitAnd",
     /*  83 */ "BitOr",
     /*  84 */ "ShiftLeft",
     /*  85 */ "ShiftRight",
     /*  86 */ "Add",
     /*  87 */ "Subtract",
     /*  88 */ "Multiply",
     /*  89 */ "Divide",
     /*  90 */ "Remainder",
     /*  91 */ "Concat",
     /*  92 */ "Yield",
     /*  93 */ "BitNot",
     /*  94 */ "String8",
     /*  95 */ "SetCookie",
     /*  96 */ "Prev",
     /*  97 */ "DropTrigger",
     /*  98 */ "FkIfZero",
     /*  99 */ "VColumn",
     /* 100 */ "Return",
     /* 101 */ "OpenWrite",
     /* 102 */ "Integer",
     /* 103 */ "Transaction",
     /* 104 */ "IfPos",
     /* 105 */ "RowSetAdd",
     /* 106 */ "CollSeq",
     /* 107 */ "Savepoint",
     /* 108 */ "VRename",
     /* 109 */ "Sequence",
     /* 110 */ "HaltIfNull",
     /* 111 */ "VCreate",
     /* 112 */ "CreateTable",
     /* 113 */ "AddImm",
     /* 114 */ "DropTable",
     /* 115 */ "IsUnique",
     /* 116 */ "VOpen",
     /* 117 */ "IfZero",
     /* 118 */ "Noop",
     /* 119 */ "InsertInt",
     /* 120 */ "RowKey",
     /* 121 */ "Expire",
     /* 122 */ "Delete",
     /* 123 */ "Blob",
     /* 124 */ "Move",
     /* 125 */ "Goto",
     /* 126 */ "ParseSchema",
     /* 127 */ "VNext",
     /* 128 */ "Seek",
     /* 129 */ "TableLock",
     /* 130 */ "Real",
     /* 131 */ "VerifyCookie",
     /* 132 */ "Column",
     /* 133 */ "OpenRead",
     /* 134 */ "ResetCount",
     /* 135 */ "NotUsed_135",
     /* 136 */ "NotUsed_136",
     /* 137 */ "NotUsed_137",
     /* 138 */ "NotUsed_138",
     /* 139 */ "NotUsed_139",
     /* 140 */ "NotUsed_140",
     /* 141 */ "ToText",
................................................................................
    }
  }
  
  /* If control gets to this point, then actually go ahead and make
  ** operating system calls for the specified lock.
  */
  if( locktype==SHARED_LOCK ){
    int lk, lrc1, lrc2;
    int lrc1Errno = 0;
    
    /* Now get the read-lock SHARED_LOCK */
    /* note that the quality of the randomness doesn't matter that much */
    lk = random(); 
    context->sharedByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
    lrc1 = afpSetLock(context->dbPath, pFile, 
          SHARED_FIRST+context->sharedByte, 1, 1);
................................................................................

/*
** Determine if we are dealing with WindowsCE - which has a much
** reduced API.
*/
#if SQLITE_OS_WINCE
# define AreFileApisANSI() 1
# define FormatMessageW(a,b,c,d,e,f,g) 0
#endif

/*
** WinCE lacks native support for file locking so we have to fake it
** with some code of our own.
*/
#if SQLITE_OS_WINCE
................................................................................

/*
** The return value of getLastErrorMsg
** is zero if the error message fits in the buffer, or non-zero
** otherwise (if the message was truncated).
*/
static int getLastErrorMsg(int nBuf, char *zBuf){





  /* FormatMessage returns 0 on failure.  Otherwise it
  ** returns the number of TCHARs written to the output
  ** buffer, excluding the terminating null char.
  */
  DWORD error = GetLastError();
  DWORD dwLen = 0;
  char *zOut;

  if( isNT() ){
    WCHAR *zTempWide = NULL;
    dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                           NULL,
                           error,
                           0,
                           (LPWSTR) &zTempWide,
                           0,
                           0);
    if( dwLen > 0 ){
      /* allocate a buffer and convert to UTF8 */
      zOut = unicodeToUtf8(zTempWide);
      /* free the system buffer allocated by FormatMessage */
      LocalFree(zTempWide);
    }
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. 
** Since the ASCII version of these Windows API do not exist for WINCE,
** it's important to not reference them for WINCE builds.
*/
#if SQLITE_OS_WINCE==0
  }else{
    char *zTemp = NULL;
    dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                           NULL,
                           error,
                           0,


                           (LPSTR) &zTemp,
                           0,
                           0);


    if( dwLen > 0 ){
      /* allocate a buffer and convert to UTF8 */
      zOut = sqlite3_win32_mbcs_to_utf8(zTemp);
      /* free the system buffer allocated by FormatMessage */
      LocalFree(zTemp);
    }
#endif
  }
  if( 0 == dwLen ){
    sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);
  }else{
    /* copy a maximum of nBuf chars to output buffer */
    sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
    /* free the UTF8 buffer */
    free(zOut);
  }
  return 0;
}

/*
** Open a file.
*/
static int winOpen(
................................................................................
        dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,
                                  &dwDummy,
                                  &bytesPerSector,
                                  &dwDummy,
                                  &dwDummy);
      }else{
        /* trim path to just drive reference */
        char *p = (char *)zConverted;
        for(;*p;p++){
          if( *p == '\\' ){
            *p = '\0';
            break;
          }
        }
        dwRet = GetDiskFreeSpaceA((char*)zConverted,
                                  &dwDummy,
                                  &bytesPerSector,
                                  &dwDummy,
                                  &dwDummy);
      }
      free(zConverted);
    }
................................................................................
** page has a small header which contains the Ptr(N) pointer and other
** information such as the size of key and data.
**
** FORMAT DETAILS
**
** The file is divided into pages.  The first page is called page 1,
** the second is page 2, and so forth.  A page number of zero indicates
** "no such page".  The page size can be any power of 2 between 512 and 32768.
** Each page can be either a btree page, a freelist page, an overflow
** page, or a pointer-map page.
**
** The first page is always a btree page.  The first 100 bytes of the first
** page contain a special header (the "file header") that describes the file.
** The format of the file header is as follows:
**
**   OFFSET   SIZE    DESCRIPTION
**      0      16     Header string: "SQLite format 3\000"
................................................................................
** A database connection contains a pointer to an instance of
** this object for every database file that it has open.  This structure
** is opaque to the database connection.  The database connection cannot
** see the internals of this structure and only deals with pointers to
** this structure.
**
** For some database files, the same underlying database cache might be 
** shared between multiple connections.  In that case, each connection
** has it own instance of this object.  But each instance of this object
** points to the same BtShared object.  The database cache and the
** schema associated with the database file are all contained within
** the BtShared object.
**
** All fields in this structure are accessed under sqlite3.mutex.
** The pBt pointer itself may not be changed while there exists cursors 
** in the referenced BtShared that point back to this Btree since those
................................................................................
/*
** A cursor is a pointer to a particular entry within a particular
** b-tree within a database file.
**
** The entry is identified by its MemPage and the index in
** MemPage.aCell[] of the entry.
**
** A single database file can shared by two more database connections,
** but cursors cannot be shared.  Each cursor is associated with a
** particular database connection identified BtCursor.pBtree.db.
**
** Fields in this structure are accessed under the BtShared.mutex
** found at self->pBt->mutex. 
*/
struct BtCursor {
................................................................................
  #define hasReadConflicts(a, b) 0
#endif

#ifndef SQLITE_OMIT_SHARED_CACHE

#ifdef SQLITE_DEBUG
/*
**** This function is only used as part of an assert() statement. ***
**
** Check to see if pBtree holds the required locks to read or write to the 

** table with root page iRoot.   Return 1 if it does and 0 if not.
**
** For example, when writing to a table with root-page iRoot via 
** Btree connection pBtree:
**
**    assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );
**
** When writing to an index that resides in a sharable database, the 
** caller should have first obtained a lock specifying the root page of
** the corresponding table. This makes things a bit more complicated,
** as this module treats each table as a separate structure. To determine
** the table corresponding to the index being written, this
** function has to search through the database schema.
**
** Instead of a lock on the table/index rooted at page iRoot, the caller may
** hold a write-lock on the schema table (root page 1). This is also
** acceptable.
*/
static int hasSharedCacheTableLock(
  Btree *pBtree,         /* Handle that must hold lock */
  Pgno iRoot,            /* Root page of b-tree */
  int isIndex,           /* True if iRoot is the root of an index b-tree */
  int eLockType          /* Required lock type (READ_LOCK or WRITE_LOCK) */
){
  Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
  Pgno iTab = 0;
  BtLock *pLock;

  /* If this database is not shareable, or if the client is reading
  ** and has the read-uncommitted flag set, then no lock is required. 
  ** Return true immediately.
  */



  if( (pBtree->sharable==0)
   || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))

  ){
    return 1;
  }

  /* If the client is reading  or writing an index and the schema is
  ** not loaded, then it is too difficult to actually check to see if
  ** the correct locks are held.  So do not bother - just return true.
  ** This case does not come up very often anyhow.
  */
  if( isIndex && (!pSchema || (pSchema->flags&DB_SchemaLoaded)==0) ){
    return 1;
  }

  /* Figure out the root-page that the lock should be held on. For table
  ** b-trees, this is just the root page of the b-tree being read or
  ** written. For index b-trees, it is the root page of the associated
  ** table.  */
  if( isIndex ){
    HashElem *p;
................................................................................
      return 1;
    }
  }

  /* Failed to find the required lock. */
  return 0;
}
#endif /* SQLITE_DEBUG */

#ifdef SQLITE_DEBUG
/*
**** This function may be used as part of assert() statements only. ****


**
** Return true if it would be illegal for pBtree to write into the
** table or index rooted at iRoot because other shared connections are
** simultaneously reading that same table or index.
**
** It is illegal for pBtree to write if some other Btree object that
** shares the same BtShared object is currently reading or writing
** the iRoot table.  Except, if the other Btree object has the
** read-uncommitted flag set, then it is OK for the other object to
** have a read cursor.
**
** For example, before writing to any part of the table or index
** rooted at page iRoot, one should call:
**
**    assert( !hasReadConflicts(pBtree, iRoot) );
*/
static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
  BtCursor *p;
  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
    if( p->pgnoRoot==iRoot 
................................................................................
    }
  }
  return 0;
}
#endif    /* #ifdef SQLITE_DEBUG */

/*
** Query to see if Btree handle p may obtain a lock of type eLock 
** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return
** SQLITE_OK if the lock may be obtained (by calling
** setSharedCacheTableLock()), or SQLITE_LOCKED if not.
*/
static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
  BtShared *pBt = p->pBt;
  BtLock *pIter;
................................................................................
  /* If requesting a write-lock, then the Btree must have an open write
  ** transaction on this file. And, obviously, for this to be so there 
  ** must be an open write transaction on the file itself.
  */
  assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
  assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );
  
  /* This routine is a no-op if the shared-cache is not enabled */
  if( !p->sharable ){
    return SQLITE_OK;
  }

  /* If some other connection is holding an exclusive lock, the
  ** requested lock may not be obtained.
  */
................................................................................
/*
** Add a lock on the table with root-page iTable to the shared-btree used
** by Btree handle p. Parameter eLock must be either READ_LOCK or 
** WRITE_LOCK.
**
** This function assumes the following:
**
**   (a) The specified Btree object p is connected to a sharable
**       database (one with the BtShared.sharable flag set), and
**
**   (b) No other Btree objects hold a lock that conflicts
**       with the requested lock (i.e. querySharedCacheTableLock() has
**       already been called and returned SQLITE_OK).
**
** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM 
** is returned if a malloc attempt fails.
*/
static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
................................................................................
  return SQLITE_OK;
}
#endif /* !SQLITE_OMIT_SHARED_CACHE */

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Release all the table locks (locks obtained via calls to
** the setSharedCacheTableLock() procedure) held by Btree object p.
**
** This function assumes that Btree p has an open read or write 
** transaction. If it does not, then the BtShared.isPending variable
** may be incorrectly cleared.
*/
static void clearAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  BtLock **ppIter = &pBt->pLock;

................................................................................

  assert( pBt->isPending==0 || pBt->pWriter );
  if( pBt->pWriter==p ){
    pBt->pWriter = 0;
    pBt->isExclusive = 0;
    pBt->isPending = 0;
  }else if( pBt->nTransaction==2 ){
    /* This function is called when Btree p is concluding its 
    ** transaction. If there currently exists a writer, and p is not
    ** that writer, then the number of locks held by connections other
    ** than the writer must be about to drop to zero. In this case
    ** set the isPending flag to 0.
    **
    ** If there is not currently a writer, then BtShared.isPending must
    ** be zero already. So this next line is harmless in that case.
    */
    pBt->isPending = 0;
  }
}

/*
** This function changes all write-locks held by Btree p into read-locks.
*/
static void downgradeAllSharedCacheTableLocks(Btree *p){
  BtShared *pBt = p->pBt;
  if( pBt->pWriter==p ){
    BtLock *pLock;
    pBt->pWriter = 0;
    pBt->isExclusive = 0;
................................................................................
}

#endif /* SQLITE_OMIT_SHARED_CACHE */

static void releasePage(MemPage *pPage);  /* Forward reference */

/*
***** This routine is used inside of assert() only ****
**
** Verify that the cursor holds the mutex on its BtShared
*/

#ifdef SQLITE_DEBUG
static int cursorHoldsMutex(BtCursor *p){
  return sqlite3_mutex_held(p->pBt->mutex);
}
#endif


#ifndef SQLITE_OMIT_INCRBLOB
................................................................................
  for(p=pBt->pCursor; p; p=p->pNext){
    invalidateOverflowCache(p);
  }
}

/*
** This function is called before modifying the contents of a table
** to invalidate any incrblob cursors that are open on the
** row or one of the rows being modified.
**
** If argument isClearTable is true, then the entire contents of the
** table is about to be deleted. In this case invalidate all incrblob
** cursors open on any row within the table with root-page pgnoRoot.
**
** Otherwise, if argument isClearTable is false, then the row with
** rowid iRow is being replaced or deleted. In this case invalidate
** only those incrblob cursors open on that specific row.
*/
static void invalidateIncrblobCursors(
  Btree *pBtree,          /* The database file to check */
  i64 iRow,               /* The rowid that might be changing */
  int isClearTable        /* True if all rows are being deleted */
){
  BtCursor *p;
................................................................................
    if( p->isIncrblobHandle && (isClearTable || p->info.nKey==iRow) ){
      p->eState = CURSOR_INVALID;
    }
  }
}

#else
  /* Stub functions when INCRBLOB is omitted */
  #define invalidateOverflowCache(x)
  #define invalidateAllOverflowCache(x)
  #define invalidateIncrblobCursors(x,y,z)
#endif /* SQLITE_OMIT_INCRBLOB */

/*
** Set bit pgno of the BtShared.pHasContent bitvec. This is called 
** when a page that previously contained data becomes a free-list leaf 
** page.
**
** The BtShared.pHasContent bitvec exists to work around an obscure
................................................................................
** is extracted from the free-list and reused, then the original data
** may be lost. In the event of a rollback, it may not be possible
** to restore the database to its original configuration.
**
** The solution is the BtShared.pHasContent bitvec. Whenever a page is 
** moved to become a free-list leaf page, the corresponding bit is
** set in the bitvec. Whenever a leaf page is extracted from the free-list,
** optimization 2 above is omitted if the corresponding bit is already
** set in BtShared.pHasContent. The contents of the bitvec are cleared
** at the end of every transaction.
*/
static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
  int rc = SQLITE_OK;
  if( !pBt->pHasContent ){
    int nPage = 100;
................................................................................
  }

  invalidateOverflowCache(pCur);
  return rc;
}

/*
** Save the positions of all cursors (except pExcept) that are open on
** the table  with root-page iRoot. Usually, this is called just before cursor
** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()).
*/
static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pExcept==0 || pExcept->pBt==pBt );
  for(p=pBt->pCursor; p; p=p->pNext){
................................................................................
  if( nSize<4 ){
    nSize = 4;
  }

  assert( nSize==debuginfo.nSize );
  return (u16)nSize;
}


#ifdef SQLITE_DEBUG
/* This variation on cellSizePtr() is used inside of assert() statements
** only. */
static u16 cellSize(MemPage *pPage, int iCell){
  return cellSizePtr(pPage, findCell(pPage, iCell));
}
#endif

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
................................................................................

/*
** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
** at the conclusion of a transaction.
*/
static void btreeEndTransaction(Btree *p){
  BtShared *pBt = p->pBt;

  assert( sqlite3BtreeHoldsMutex(p) );








  btreeClearHasContent(pBt);

  if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
    /* If there are other active statements that belong to this database
    ** handle, downgrade to a read-only transaction. The other statements
    ** may still be reading from the database.  */
    downgradeAllSharedCacheTableLocks(p);
    p->inTrans = TRANS_READ;
  }else{
    /* If the handle had any kind of transaction open, decrement the 
    ** transaction count of the shared btree. If the transaction count 
    ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()
    ** call below will unlock the pager.  */
................................................................................
  const void *pData, int nData,  /* The data of the new record */
  int nZero,                     /* Number of extra 0 bytes to append to data */
  int appendBias,                /* True if this is likely an append */
  int seekResult                 /* Result of prior MovetoUnpacked() call */
){
  int rc;
  int loc = seekResult;          /* -1: before desired location  +1: after */
  int szNew = 0;
  int idx;
  MemPage *pPage;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;
  unsigned char *oldCell;
  unsigned char *newCell = 0;

................................................................................
    nVal = sqlite3Strlen30(zVal)-1;
    assert( zVal[nVal]=='\'' );
    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
                         0, SQLITE_DYNAMIC);
  }
#endif

  if( pVal ){
    sqlite3VdbeMemStoreType(pVal);
  }
  *ppVal = pVal;
  return SQLITE_OK;

no_mem:
  db->mallocFailed = 1;
  sqlite3DbFree(db, zVal);
  sqlite3ValueFree(pVal);
................................................................................
  return p;
}

/*
** Remember the SQL string for a prepared statement.
*/
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){
  assert( isPrepareV2==1 || isPrepareV2==0 );
  if( p==0 ) return;
#ifdef SQLITE_OMIT_TRACE
  if( !isPrepareV2 ) return;
#endif
  assert( p->zSql==0 );
  p->zSql = sqlite3DbStrNDup(p->db, z, n);
  p->isPrepareV2 = isPrepareV2;
}

/*
** Return the SQL associated with a prepared statement
*/
SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe *)pStmt;
................................................................................
  for(i=0; i<p->nChildCsr; i++){
    sqlite3VdbeFreeCursor(p->v, apCsr[i]);
  }
  releaseMemArray(aMem, p->nChildMem);
  sqlite3DbFree(p->v->db, p);
}






















#ifndef SQLITE_OMIT_EXPLAIN
/*
** Give a listing of the program in the virtual machine.
**
** The interface is the same as sqlite3VdbeExec().  But instead of
** running the code, it invokes the callback once for each instruction.
** This feature is used to implement "EXPLAIN".
................................................................................

/*
** Return the database associated with the Vdbe.
*/
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
  return v->db;
}

/*
** Return a pointer to an sqlite3_value structure containing the value bound
** parameter iVar of VM v. Except, if the value is an SQL NULL, return 
** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*
** constants) to the value before returning it.
**
** The returned value must be freed by the caller using sqlite3ValueFree().
*/
SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe *v, int iVar, u8 aff){
  assert( iVar>0 );
  if( v ){
    Mem *pMem = &v->aVar[iVar-1];
    if( 0==(pMem->flags & MEM_Null) ){
      sqlite3_value *pRet = sqlite3ValueNew(v->db);
      if( pRet ){
        sqlite3VdbeMemCopy((Mem *)pRet, pMem);
        sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8);
        sqlite3VdbeMemStoreType((Mem *)pRet);
      }
      return pRet;
    }
  }
  return 0;
}

/*
** Configure SQL variable iVar so that binding a new value to it signals
** to sqlite3_reoptimize() that re-preparing the statement may result
** in a better query plan.
*/
SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
  assert( iVar>0 );
  if( iVar>32 ){
    v->expmask = 0xffffffff;
  }else{
    v->expmask |= ((u32)1 << (iVar-1));
  }
}

/************** End of vdbeaux.c *********************************************/
/************** Begin file vdbeapi.c *****************************************/
/*
** 2004 May 26
**
** The author disclaims copyright to this source code.  In place of
................................................................................
#if SQLITE_THREADSAFE
  sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
#endif
  sqlite3_mutex_enter(mutex);
  for(i=0; i<p->nVar; i++){
    sqlite3VdbeMemRelease(&p->aVar[i]);
    p->aVar[i].flags = MEM_Null;
  }
  if( p->isPrepareV2 && p->expmask ){
    p->expired = 1;
  }
  sqlite3_mutex_leave(mutex);
  return rc;
}


/**************************** sqlite3_value_  *******************************
................................................................................
  /* Assert that malloc() has not failed */
  db = p->db;
  if( db->mallocFailed ){
    return SQLITE_NOMEM;
  }

  if( p->pc<=0 && p->expired ){
    if( ALWAYS(p->rc==SQLITE_OK || p->rc==SQLITE_SCHEMA) ){
      p->rc = SQLITE_SCHEMA;
    }
    rc = SQLITE_ERROR;
    goto end_of_step;
  }
  if( sqlite3SafetyOn(db) ){
    p->rc = SQLITE_MISUSE;
................................................................................
    return SQLITE_RANGE;
  }
  i--;
  pVar = &p->aVar[i];
  sqlite3VdbeMemRelease(pVar);
  pVar->flags = MEM_Null;
  sqlite3Error(p->db, SQLITE_OK, 0);

  /* If the bit corresponding to this variable in Vdbe.expmask is set, then 
  ** binding a new value to this variable invalidates the current query plan.
  */
  if( p->isPrepareV2 &&
     ((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff)
  ){
    p->expired = 1;
  }
  return SQLITE_OK;
}

/*
** Bind a text or BLOB value.
*/
static int bindText(
................................................................................
** SQLITE_OK is returned.
*/
SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
  Vdbe *pFrom = (Vdbe*)pFromStmt;
  Vdbe *pTo = (Vdbe*)pToStmt;
  if( pFrom->nVar!=pTo->nVar ){
    return SQLITE_ERROR;
  }
  if( pTo->isPrepareV2 && pTo->expmask ){
    pTo->expired = 1;
  }
  if( pFrom->isPrepareV2 && pFrom->expmask ){
    pFrom->expired = 1;
  }
  return sqlite3TransferBindings(pFromStmt, pToStmt);
}
#endif

/*
** Return the sqlite3* database handle to which the prepared statement given
................................................................................
** P if required.
*/
#define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)

/*
** Argument pMem points at a register that will be passed to a
** user-defined function or returned to the user as the result of a query.
** This routine sets the pMem->type variable used by the sqlite3_value_*() 
** routines.
*/
SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){


  int flags = pMem->flags;
  if( flags & MEM_Null ){
    pMem->type = SQLITE_NULL;
  }
  else if( flags & MEM_Int ){
    pMem->type = SQLITE_INTEGER;
  }
................................................................................
** loss of information and return the revised type of the argument.
**
** This is an EXPERIMENTAL api and is subject to change or removal.
*/
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
  Mem *pMem = (Mem*)pVal;
  applyNumericAffinity(pMem);
  sqlite3VdbeMemStoreType(pMem);
  return pMem->type;
}

/*
** Exported version of applyAffinity(). This one works on sqlite3_value*, 
** not the internal Mem* type.
*/
................................................................................
      i64 v;                 /* The new rowid */
      VdbeCursor *pC;        /* Cursor of table to get the new rowid */
      int res;               /* Result of an sqlite3BtreeLast() */
      int cnt;               /* Counter to limit the number of searches */
      Mem *pMem;             /* Register holding largest rowid for AUTOINCREMENT */
      VdbeFrame *pFrame;     /* Root frame of VDBE */
    } be;
    struct OP_InsertInt_stack_vars {
      Mem *pData;       /* MEM cell holding data for the record to be inserted */
      Mem *pKey;        /* MEM cell holding key  for the record */
      i64 iKey;         /* The integer ROWID or key for the record to be inserted */
      VdbeCursor *pC;   /* Cursor to table into which insert is written */
      int nZero;        /* Number of zero-bytes to append */
      int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
      const char *zDb;  /* database name - used by the update hook */
................................................................................
#endif /* local variables moved into u.ab */

  u.ab.p1 = pOp->p1 - 1;
  u.ab.p2 = pOp->p2;
  u.ab.n = pOp->p3;
  assert( u.ab.p1>=0 && u.ab.p1+u.ab.n<=p->nVar );
  assert( u.ab.p2>=1 && u.ab.p2+u.ab.n-1<=p->nMem );
  assert( pOp->p4.z==0 || pOp->p3==1 || pOp->p3==0 );

  while( u.ab.n-- > 0 ){
    u.ab.pVar = &p->aVar[u.ab.p1++];
    if( sqlite3VdbeMemTooBig(u.ab.pVar) ){
      goto too_big;
    }
    pOut = &p->aMem[u.ab.p2++];
................................................................................
  /* Make sure the results of the current row are \000 terminated
  ** and have an assigned type.  The results are de-ephemeralized as
  ** as side effect.
  */
  u.ad.pMem = p->pResultSet = &p->aMem[pOp->p1];
  for(u.ad.i=0; u.ad.i<pOp->p2; u.ad.i++){
    sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
    sqlite3VdbeMemStoreType(&u.ad.pMem[u.ad.i]);
    REGISTER_TRACE(pOp->p1+u.ad.i, &u.ad.pMem[u.ad.i]);
  }
  if( db->mallocFailed ) goto no_mem;

  /* Return SQLITE_ROW
  */
  p->pc = pc + 1;
................................................................................
  assert( u.ag.apVal || u.ag.n==0 );

  assert( u.ag.n==0 || (pOp->p2>0 && pOp->p2+u.ag.n<=p->nMem+1) );
  assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+u.ag.n );
  u.ag.pArg = &p->aMem[pOp->p2];
  for(u.ag.i=0; u.ag.i<u.ag.n; u.ag.i++, u.ag.pArg++){
    u.ag.apVal[u.ag.i] = u.ag.pArg;
    sqlite3VdbeMemStoreType(u.ag.pArg);
    REGISTER_TRACE(pOp->p2, u.ag.pArg);
  }

  assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC );
  if( pOp->p4type==P4_FUNCDEF ){
    u.ag.ctx.pFunc = pOp->p4.pFunc;
    u.ag.ctx.pVdbeFunc = 0;
................................................................................
    /* Record changes in the file format */
    u.au.pDb->pSchema->file_format = (u8)pIn3->u.i;
  }
  if( pOp->p1==1 ){
    /* Invalidate all prepared statements whenever the TEMP database
    ** schema is changed.  Ticket #1644 */
    sqlite3ExpirePreparedStatements(db);
    p->expired = 0;
  }
  break;
}

/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
................................................................................
  int p2;
  int iDb;
  int wrFlag;
  Btree *pX;
  VdbeCursor *pCur;
  Db *pDb;
#endif /* local variables moved into u.aw */

  if( p->expired ){
    rc = SQLITE_ABORT;
    break;
  }

  u.aw.nField = 0;
  u.aw.pKeyInfo = 0;
  u.aw.p2 = pOp->p2;
  u.aw.iDb = pOp->p3;
  assert( u.aw.iDb>=0 && u.aw.iDb<db->nDb );
  assert( (p->btreeMask & (1<<u.aw.iDb))!=0 );
................................................................................
** and register P2 becomes ephemeral.  If the cursor is changed, the
** value of register P2 will then change.  Make sure this does not
** cause any problems.)
**
** This instruction only works on tables.  The equivalent instruction
** for indices is OP_IdxInsert.
*/
/* Opcode: InsertInt P1 P2 P3 P4 P5
**
** This works exactly like OP_Insert except that the key is the
** integer value P3, not the value of the integer stored in register P3.
*/
case OP_Insert: 
case OP_InsertInt: {
#if 0  /* local variables moved into u.bf */
  Mem *pData;       /* MEM cell holding data for the record to be inserted */
  Mem *pKey;        /* MEM cell holding key  for the record */
  i64 iKey;         /* The integer ROWID or key for the record to be inserted */
  VdbeCursor *pC;   /* Cursor to table into which insert is written */
  int nZero;        /* Number of zero-bytes to append */
  int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
  const char *zDb;  /* database name - used by the update hook */
  const char *zTbl; /* Table name - used by the opdate hook */
  int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */
#endif /* local variables moved into u.bf */

  u.bf.pData = &p->aMem[pOp->p2];

  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  u.bf.pC = p->apCsr[pOp->p1];
  assert( u.bf.pC!=0 );
  assert( u.bf.pC->pCursor!=0 );
  assert( u.bf.pC->pseudoTableReg==0 );

  assert( u.bf.pC->isTable );
  REGISTER_TRACE(pOp->p2, u.bf.pData);


  if( pOp->opcode==OP_Insert ){
    u.bf.pKey = &p->aMem[pOp->p3];
    assert( u.bf.pKey->flags & MEM_Int );
    REGISTER_TRACE(pOp->p3, u.bf.pKey);
    u.bf.iKey = u.bf.pKey->u.i;
  }else{
    assert( pOp->opcode==OP_InsertInt );
    u.bf.iKey = pOp->p3;
  }

  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = u.bf.iKey;
  if( u.bf.pData->flags & MEM_Null ){
    u.bf.pData->z = 0;
    u.bf.pData->n = 0;
  }else{
    assert( u.bf.pData->flags & (MEM_Blob|MEM_Str) );
  }
  u.bf.seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? u.bf.pC->seekResult : 0);
................................................................................
  u.cc.n = pOp->p5;
  assert( u.cc.n>=0 );
  u.cc.pRec = &p->aMem[pOp->p2];
  u.cc.apVal = p->apArg;
  assert( u.cc.apVal || u.cc.n==0 );
  for(u.cc.i=0; u.cc.i<u.cc.n; u.cc.i++, u.cc.pRec++){
    u.cc.apVal[u.cc.i] = u.cc.pRec;
    sqlite3VdbeMemStoreType(u.cc.pRec);
  }
  u.cc.ctx.pFunc = pOp->p4.pFunc;
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  u.cc.ctx.pMem = u.cc.pMem = &p->aMem[pOp->p3];
  u.cc.pMem->n++;
  u.cc.ctx.s.flags = MEM_Null;
  u.cc.ctx.s.z = 0;
................................................................................

  /* Invoke the xFilter method */
  {
    u.ch.res = 0;
    u.ch.apArg = p->apArg;
    for(u.ch.i = 0; u.ch.i<u.ch.nArg; u.ch.i++){
      u.ch.apArg[u.ch.i] = &u.ch.pArgc[u.ch.i+1];
      sqlite3VdbeMemStoreType(u.ch.apArg[u.ch.i]);
    }

    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    p->inVtabMethod = 1;
    rc = u.ch.pModule->xFilter(u.ch.pVtabCursor, u.ch.iQuery, pOp->p4.z, u.ch.nArg, u.ch.apArg);
    p->inVtabMethod = 0;
    sqlite3DbFree(db, p->zErrMsg);
................................................................................
  u.cl.pModule = (sqlite3_module *)u.cl.pVtab->pModule;
  u.cl.nArg = pOp->p2;
  assert( pOp->p4type==P4_VTAB );
  if( ALWAYS(u.cl.pModule->xUpdate) ){
    u.cl.apArg = p->apArg;
    u.cl.pX = &p->aMem[pOp->p3];
    for(u.cl.i=0; u.cl.i<u.cl.nArg; u.cl.i++){
      sqlite3VdbeMemStoreType(u.cl.pX);
      u.cl.apArg[u.cl.i] = u.cl.pX;
      u.cl.pX++;
    }
    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    rc = u.cl.pModule->xUpdate(u.cl.pVtab, u.cl.nArg, u.cl.apArg, &u.cl.rowid);
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = u.cl.pVtab->zErrMsg;
................................................................................
      pTopNC = pTopNC->pNext;
    }
    return WRC_Prune;
  } else {
    return WRC_Abort;
  }
}

/*
** Allocate and return a pointer to an expression to load the column iCol
** from datasource iSrc datasource in SrcList pSrc.
*/
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
  Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
  if( p ){
    struct SrcList_item *pItem = &pSrc->a[iSrc];
    p->pTab = pItem->pTab;
    p->iTable = pItem->iCursor;
    if( p->pTab->iPKey==iCol ){
      p->iColumn = -1;
    }else{
      p->iColumn = iCol;
      pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
    }
    ExprSetProperty(p, EP_Resolved);
  }
  return p;
}

/*
** This routine is callback for sqlite3WalkExpr().
**
** Resolve symbolic names into TK_COLUMN operators for the current
** node in the expression tree.  Return 0 to continue the search down
** the tree or 2 to abort the tree walk.
................................................................................
  assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
  z = pExpr->u.zToken;
  assert( z!=0 );
  assert( z[0]!=0 );
  if( z[1]==0 ){
    /* Wildcard of the form "?".  Assign the next variable number */
    assert( z[0]=='?' );
    pExpr->iColumn = ++pParse->nVar;
  }else if( z[0]=='?' ){
    /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
    ** use it as the variable number */
    int i;
    pExpr->iColumn = i = atoi((char*)&z[1]);
    testcase( i==0 );
    testcase( i==1 );
    testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
    testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );
    if( i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
      sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
          db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
................................................................................
    int i;
    u32 n;
    n = sqlite3Strlen30(z);
    for(i=0; i<pParse->nVarExpr; i++){
      Expr *pE = pParse->apVarExpr[i];
      assert( pE!=0 );
      if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){
        pExpr->iColumn = pE->iColumn;
        break;
      }
    }
    if( i>=pParse->nVarExpr ){
      pExpr->iColumn = ++pParse->nVar;
      if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
        pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
        pParse->apVarExpr =
            sqlite3DbReallocOrFree(
              db,
              pParse->apVarExpr,
              pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0])
................................................................................
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
  Select *p;                            /* SELECT to the right of IN operator */
  int eType = 0;                        /* Type of RHS table. IN_INDEX_* */
  int iTab = pParse->nTab++;            /* Cursor of the RHS table */
  int mustBeUnique = (prNotFound==0);   /* True if RHS must be unique */

  assert( pX->op==TK_IN );

  /* Check to see if an existing table or index can be used to
  ** satisfy the query.  This is preferable to generating a new 
  ** ephemeral table.
  */
  p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0);
  if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){
................................................................................
          }
        }
      }
    }
  }

  if( eType==0 ){
    /* Could not found an existing table or index to use as the RHS b-tree.
    ** We will have to generate an ephemeral table to do the job.
    */
    int rMayHaveNull = 0;
    eType = IN_INDEX_EPH;
    if( prNotFound ){
      *prNotFound = rMayHaveNull = ++pParse->nMem;
    }else if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){
................................................................................
** all corresponding LHS elements.  All this routine does is initialize
** the register given by rMayHaveNull to NULL.  Calling routines will take
** care of changing this register value to non-NULL if the RHS is NULL-free.
**
** If rMayHaveNull is zero, that means that the subquery is being used
** for membership testing only.  There is no need to initialize any
** registers to indicate the presense or absence of NULLs on the RHS.
**
** For a SELECT or EXISTS operator, return the register that holds the
** result.  For IN operators or if an error occurs, the return value is 0.
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3CodeSubselect(
  Parse *pParse,          /* Parsing context */
  Expr *pExpr,            /* The IN, SELECT, or EXISTS operator */
  int rMayHaveNull,       /* Register that records whether NULLs exist in RHS */
  int isRowid             /* If true, LHS of IN operator is a rowid */
){
  int testAddr = 0;                       /* One-time test address */
  int rReg = 0;                           /* Register storing resulting */
  Vdbe *v = sqlite3GetVdbe(pParse);
  if( NEVER(v==0) ) return 0;
  sqlite3ExprCachePush(pParse);

  /* This code must be run in its entirety every time it is encountered
  ** if any of the following is true:
  **
  **    *  The right-hand side is a correlated subquery
  **    *  The right-hand side is an expression list containing variables
................................................................................
        ExprList *pEList;

        assert( !isRowid );
        sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
        dest.affinity = (u8)affinity;
        assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
        if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){
          return 0;
        }
        pEList = pExpr->x.pSelect->pEList;
        if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){ 
          keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,
              pEList->a[0].pExpr);
        }
      }else if( pExpr->x.pList!=0 ){
................................................................................

        /* Loop through each expression in <exprlist>. */
        r1 = sqlite3GetTempReg(pParse);
        r2 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
          Expr *pE2 = pItem->pExpr;
          int iValToIns;

          /* If the expression is not constant then we will need to
          ** disable the test that was generated above that makes sure
          ** this code only executes once.  Because for a non-constant
          ** expression we need to rerun this code each time.
          */
          if( testAddr && !sqlite3ExprIsConstant(pE2) ){
            sqlite3VdbeChangeToNoop(v, testAddr-1, 2);
            testAddr = 0;
          }

          /* Evaluate the expression and insert it into the temp table */
          if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
            sqlite3VdbeAddOp3(v, OP_InsertInt, pExpr->iTable, r2, iValToIns);
          }else{
            r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
            if( isRowid ){
              sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,
                                sqlite3VdbeCurrentAddr(v)+2);
              sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
            }else{
              sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
              sqlite3ExprCacheAffinityChange(pParse, r3, 1);
              sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2);
            }
          }
        }
        sqlite3ReleaseTempReg(pParse, r1);
        sqlite3ReleaseTempReg(pParse, r2);
      }
      if( !isRowid ){
        sqlite3VdbeChangeP4(v, addr, (void *)&keyInfo, P4_KEYINFO);
................................................................................
        dest.eDest = SRT_Exists;
        sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iParm);
        VdbeComment((v, "Init EXISTS result"));
      }
      sqlite3ExprDelete(pParse->db, pSel->pLimit);
      pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &one);
      if( sqlite3Select(pParse, pSel, &dest) ){
        return 0;
      }
      rReg = dest.iParm;
      ExprSetIrreducible(pExpr);
      break;
    }
  }

  if( testAddr ){
    sqlite3VdbeJumpHere(v, testAddr-1);
  }
  sqlite3ExprCachePop(pParse, 1);

  return rReg;
}
#endif /* SQLITE_OMIT_SUBQUERY */

/*
** Duplicate an 8-byte value
*/
static char *dup8bytes(Vdbe *v, const char *in){
................................................................................
    case TK_VARIABLE: {
      VdbeOp *pOp;
      assert( !ExprHasProperty(pExpr, EP_IntValue) );
      assert( pExpr->u.zToken!=0 );
      assert( pExpr->u.zToken[0]!=0 );
      if( pExpr->u.zToken[1]==0
         && (pOp = sqlite3VdbeGetOp(v, -1))->opcode==OP_Variable
         && pOp->p1+pOp->p3==pExpr->iColumn
         && pOp->p2+pOp->p3==target
         && pOp->p4.z==0
      ){
        /* If the previous instruction was a copy of the previous unnamed
        ** parameter into the previous register, then simply increment the
        ** repeat count on the prior instruction rather than making a new
        ** instruction.
        */
        pOp->p3++;
      }else{
        sqlite3VdbeAddOp3(v, OP_Variable, pExpr->iColumn, target, 1);
        if( pExpr->u.zToken[1]!=0 ){
          sqlite3VdbeChangeP4(v, -1, pExpr->u.zToken, 0);
        }
      }
      break;
    }
    case TK_REGISTER: {
................................................................................
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_EXISTS:
    case TK_SELECT: {
      testcase( op==TK_EXISTS );
      testcase( op==TK_SELECT );
      inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);

      break;
    }
    case TK_IN: {
      int rNotFound = 0;
      int rMayHaveNull = 0;
      int j2, j3, j4, j5;
      char affinity;
................................................................................
  ** keep the ALWAYS() in case the conditions above change with future
  ** modifications or enhancements. */
  if( ALWAYS(pExpr->op!=TK_REGISTER) ){  
    int iMem;
    iMem = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
    pExpr->iTable = iMem;
    pExpr->op2 = pExpr->op;
    pExpr->op = TK_REGISTER;
  }
  return inReg;
}

/*
** Return TRUE if pExpr is an constant expression that is appropriate
................................................................................
** factoring out of a loop, then evaluate the expression
** into a register and convert the expression into a TK_REGISTER
** expression.
*/
static int evalConstExpr(Walker *pWalker, Expr *pExpr){
  Parse *pParse = pWalker->pParse;
  switch( pExpr->op ){
    case TK_IN:
    case TK_REGISTER: {
      return WRC_Prune;
    }
    case TK_FUNCTION:
    case TK_AGG_FUNCTION:
    case TK_CONST_FUNC: {
      /* The arguments to a function have a fixed destination.
................................................................................
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */
  Vdbe *pReprepare,         /* VM being reprepared */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  Parse *pParse;            /* Parsing context */
  char *zErrMsg = 0;        /* Error message */
  int rc = SQLITE_OK;       /* Result code */
  int i;                    /* Loop counter */
................................................................................

  /* Allocate the parsing context */
  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
  if( pParse==0 ){
    rc = SQLITE_NOMEM;
    goto end_prepare;
  }
  pParse->pReprepare = pReprepare;

  if( sqlite3SafetyOn(db) ){
    rc = SQLITE_MISUSE;
    goto end_prepare;
  }
  assert( ppStmt && *ppStmt==0 );
  assert( !db->mallocFailed );
................................................................................
  return rc;
}
static int sqlite3LockAndPrepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */
  Vdbe *pOld,               /* VM being reprepared */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  assert( ppStmt!=0 );
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  if( rc==SQLITE_SCHEMA ){
    sqlite3_finalize(*ppStmt);
    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  }
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
................................................................................
  sqlite3 *db;

  assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
  zSql = sqlite3_sql((sqlite3_stmt *)p);
  assert( zSql!=0 );  /* Reprepare only called for prepare_v2() statements */
  db = sqlite3VdbeDb(p);
  assert( sqlite3_mutex_held(db->mutex) );
  rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);
  if( rc ){
    if( rc==SQLITE_NOMEM ){
      db->mallocFailed = 1;
    }
    assert( pNew==0 );
    return (rc==SQLITE_LOCKED) ? SQLITE_LOCKED : SQLITE_SCHEMA;
  }else{
................................................................................
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}
SQLITE_API int sqlite3_prepare_v2(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}


#ifndef SQLITE_OMIT_UTF16
/*
................................................................................
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);
  zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
  if( zSql8 ){
    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
  }

  if( zTail8 && pzTail ){
    /* If sqlite3_prepare returns a tail pointer, we calculate the
    ** equivalent pointer into the UTF-16 string by counting the unicode
    ** characters between zSql8 and zTail8, and then returning a pointer
    ** the same number of characters into the UTF-16 string.
................................................................................
  for(i=0; i<pTab->nCol; i++){
    if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
  }
  return -1;
}

/*
** This function is used to add terms implied by JOIN syntax to the
** WHERE clause expression of a SELECT statement. The new term, which
** is ANDed with the existing WHERE clause, is of the form:
**




**    (tab1.col1 = tab2.col2)
**
** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the 
** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is
** column iColRight of tab2.
*/
static void addWhereTerm(
  Parse *pParse,                  /* Parsing context */
  SrcList *pSrc,                  /* List of tables in FROM clause */
  int iSrc,                       /* Index of first table to join in pSrc */
  int iColLeft,                   /* Index of column in first table */
  int iColRight,                  /* Index of column in second table */
  int isOuterJoin,                /* True if this is an OUTER join */
  Expr **ppWhere                  /* IN/OUT: The WHERE clause to add to */


){
  sqlite3 *db = pParse->db;
  Expr *pE1;
  Expr *pE2;
  Expr *pEq;

  assert( pSrc->nSrc>(iSrc+1) );
  assert( pSrc->a[iSrc].pTab );
  assert( pSrc->a[iSrc+1].pTab );






  pE1 = sqlite3CreateColumnExpr(db, pSrc, iSrc, iColLeft);
  pE2 = sqlite3CreateColumnExpr(db, pSrc, iSrc+1, iColRight);




  pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2, 0);
  if( pEq && isOuterJoin ){
    ExprSetProperty(pEq, EP_FromJoin);
    assert( !ExprHasAnyProperty(pEq, EP_TokenOnly|EP_Reduced) );
    ExprSetIrreducible(pEq);
    pEq->iRightJoinTable = (i16)pE2->iTable;
  }
  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
}

/*
** Set the EP_FromJoin property on all terms of the given expression.
** And set the Expr.iRightJoinTable to iTable for every term in the
** expression.
**
................................................................................
      if( pRight->pOn || pRight->pUsing ){
        sqlite3ErrorMsg(pParse, "a NATURAL join may not have "
           "an ON or USING clause", 0);
        return 1;
      }
      for(j=0; j<pLeftTab->nCol; j++){
        char *zName = pLeftTab->aCol[j].zName;
        int iRightCol = columnIndex(pRightTab, zName);
        if( iRightCol>=0 ){
          addWhereTerm(pParse, pSrc, i, j, iRightCol, isOuter, &p->pWhere);



        }
      }
    }

    /* Disallow both ON and USING clauses in the same join
    */
    if( pRight->pOn && pRight->pUsing ){
................................................................................
    ** Report an error if any column mentioned in the USING clause is
    ** not contained in both tables to be joined.
    */
    if( pRight->pUsing ){
      IdList *pList = pRight->pUsing;
      for(j=0; j<pList->nId; j++){
        char *zName = pList->a[j].zName;
        int iLeftCol = columnIndex(pLeftTab, zName);
        int iRightCol = columnIndex(pRightTab, zName);
        if( iLeftCol<0 || iRightCol<0 ){
          sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
            "not present in both tables", zName);
          return 1;
        }
        addWhereTerm(pParse, pSrc, i, iLeftCol, iRightCol, isOuter, &p->pWhere);


      }
    }
  }
  return 0;
}

/*
................................................................................
  sqlite3 *db = pParse->db; /* Database connection */
  const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
  SelectDest dest;

  /* Construct the SELECT statement that will find the new values for
  ** all updated rows. 
  */
  pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, "_rowid_"));

  if( pRowid ){
    pEList = sqlite3ExprListAppend(pParse, pEList,
                                   sqlite3ExprDup(db, pRowid, 0));
  }
  assert( pTab->iPKey<0 );
  for(i=0; i<pTab->nCol; i++){
    if( aXRef[i]>=0 ){
      pExpr = sqlite3ExprDup(db, pChanges->a[aXRef[i]].pExpr, 0);
    }else{
      pExpr = sqlite3Expr(db, TK_ID, pTab->aCol[i].zName);
    }
    pEList = sqlite3ExprListAppend(pParse, pEList, pExpr);
  }
  pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);
  
  /* Create the ephemeral table into which the update results will
  ** be stored.
................................................................................
  */
  zSql = "ATTACH '' AS vacuum_db;";
  rc = execSql(db, zSql);
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  pDb = &db->aDb[db->nDb-1];
  assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
  pTemp = db->aDb[db->nDb-1].pBt;

  /* The call to execSql() to attach the temp database has left the file
  ** locked (as there was more than one active statement when the transaction
  ** to read the schema was concluded. Unlock it here so that this doesn't
  ** cause problems for the call to BtreeSetPageSize() below.  */
  sqlite3BtreeCommit(pTemp);

  nRes = sqlite3BtreeGetReserve(pMain);

  /* A VACUUM cannot change the pagesize of an encrypted database. */
#ifdef SQLITE_HAS_CODEC
  if( db->nextPagesize ){
    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
................................................................................
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  rc = execExecSql(db, 
      "SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) "
      "  FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
  if( rc!=SQLITE_OK ) goto end_of_vacuum;

  /* Loop through the tables in the main database. For each, do
  ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
  ** the contents to the temporary database.
  */
  rc = execExecSql(db, 
      "SELECT 'INSERT INTO vacuum_db.' || quote(name) "
      "|| ' SELECT * FROM main.' || quote(name) || ';'"
      "FROM main.sqlite_master "
      "WHERE type = 'table' AND name!='sqlite_sequence' "
      "  AND rootpage>0"

  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;

  /* Copy over the sequence table
................................................................................
  rc = execExecSql(db, 
      "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' "
      "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' "
  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  rc = execExecSql(db, 
      "SELECT 'INSERT INTO vacuum_db.' || quote(name) "
      "|| ' SELECT * FROM main.' || quote(name) || ';' "
      "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';"
  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;


  /* Copy the triggers, views, and virtual tables from the main database
  ** over to the temporary database.  None of these objects has any
  ** associated storage, so all we have to do is copy their entries
  ** from the SQLITE_MASTER table.
  */
  rc = execSql(db,
      "INSERT INTO vacuum_db.sqlite_master "
      "  SELECT type, name, tbl_name, rootpage, sql"
      "    FROM main.sqlite_master"
      "   WHERE type='view' OR type='trigger'"
      "      OR (type='table' AND rootpage=0)"
  );
  if( rc ) goto end_of_vacuum;

  /* At this point, unless the main db was completely empty, there is now a
  ** transaction open on the vacuum database, but not on the main database.
................................................................................
**
** In order for the operator to be optimizible, the RHS must be a string
** literal that does not begin with a wildcard.  
*/
static int isLikeOrGlob(
  Parse *pParse,    /* Parsing and code generating context */
  Expr *pExpr,      /* Test this expression */
  Expr **ppPrefix,  /* Pointer to TK_STRING expression with pattern prefix */
  int *pisComplete, /* True if the only wildcard is % in the last character */
  int *pnoCase      /* True if uppercase is equivalent to lowercase */
){
  const char *z = 0;         /* String on RHS of LIKE operator */
  Expr *pRight, *pLeft;      /* Right and left size of LIKE operator */
  ExprList *pList;           /* List of operands to the LIKE operator */
  int c;                     /* One character in z[] */
  int cnt;                   /* Number of non-wildcard prefix characters */
  char wc[3];                /* Wildcard characters */
  CollSeq *pColl;            /* Collating sequence for LHS */
  sqlite3 *db = pParse->db;  /* Database connection */
  sqlite3_value *pVal = 0;
  int op;                    /* Opcode of pRight */

  if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
    return 0;
  }
#ifdef SQLITE_EBCDIC
  if( *pnoCase ) return 0;
#endif
  pList = pExpr->x.pList;




  pLeft = pList->a[1].pExpr;
  if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ){
    /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must
    ** be the name of an indexed column with TEXT affinity. */
    return 0;
  }
  assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */
  pColl = sqlite3ExprCollSeq(pParse, pLeft);


  assert( pColl!=0 );  /* Every non-IPK column has a collating sequence */
  if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) &&
      (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){
    /* IMP: R-09003-32046 For the GLOB operator, the column must use the
    ** default BINARY collating sequence.
    ** IMP: R-41408-28306 For the LIKE operator, if case_sensitive_like mode
    ** is enabled then the column must use the default BINARY collating
    ** sequence, or if case_sensitive_like mode is disabled then the column
    ** must use the built-in NOCASE collating sequence.
    */
    return 0;
  }


  pRight = pList->a[0].pExpr;
  op = pRight->op;
  if( op==TK_REGISTER ){
    op = pRight->op2;
  }
  if( op==TK_VARIABLE ){
    Vdbe *pReprepare = pParse->pReprepare;
    pVal = sqlite3VdbeGetValue(pReprepare, pRight->iColumn, SQLITE_AFF_NONE);
    if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
      z = (char *)sqlite3_value_text(pVal);
    }
    sqlite3VdbeSetVarmask(pParse->pVdbe, pRight->iColumn);
    assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
  }else if( op==TK_STRING ){
    z = pRight->u.zToken;

  }
  if( z ){
    cnt = 0;
    while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
      cnt++;
    }
    if( cnt!=0 && c!=0 && 255!=(u8)z[cnt-1] ){
      Expr *pPrefix;
      *pisComplete = z[cnt]==wc[0] && z[cnt+1]==0;

      pPrefix = sqlite3Expr(db, TK_STRING, z);
      if( pPrefix ) pPrefix->u.zToken[cnt] = 0;
      *ppPrefix = pPrefix;
      if( op==TK_VARIABLE ){
        Vdbe *v = pParse->pVdbe;
        sqlite3VdbeSetVarmask(v, pRight->iColumn);
        if( *pisComplete && pRight->u.zToken[1] ){
          /* If the rhs of the LIKE expression is a variable, and the current
          ** value of the variable means there is no need to invoke the LIKE
          ** function, then no OP_Variable will be added to the program.
          ** This causes problems for the sqlite3_bind_parameter_name()
          ** API. To workaround them, add a dummy OP_Variable here.
          */ 
          int r1 = sqlite3GetTempReg(pParse);
          sqlite3ExprCodeTarget(pParse, pRight, r1);
          sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
          sqlite3ReleaseTempReg(pParse, r1);
        }
      }
    }else{
      z = 0;
    }
  }

  sqlite3ValueFree(pVal);
  return (z!=0);
}
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */


#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Check to see if the given expression is of the form
................................................................................
  int idxTerm               /* Index of the term to be analyzed */
){
  WhereTerm *pTerm;                /* The term to be analyzed */
  WhereMaskSet *pMaskSet;          /* Set of table index masks */
  Expr *pExpr;                     /* The expression to be analyzed */
  Bitmask prereqLeft;              /* Prerequesites of the pExpr->pLeft */
  Bitmask prereqAll;               /* Prerequesites of pExpr */
  Bitmask extraRight = 0;          /* */
  Expr *pStr1 = 0;                 /* RHS of LIKE/GLOB operator */
  int isComplete = 0;              /* RHS of LIKE/GLOB ends with wildcard */
  int noCase = 0;                  /* LIKE/GLOB distinguishes case */
  int op;                          /* Top-level operator.  pExpr->op */
  Parse *pParse = pWC->pParse;     /* Parsing context */
  sqlite3 *db = pParse->db;        /* Database connection */

  if( db->mallocFailed ){
    return;
  }
................................................................................
  ** A like pattern of the form "x LIKE 'abc%'" is changed into constraints
  **
  **          x>='abc' AND x<'abd' AND x LIKE 'abc%'
  **
  ** The last character of the prefix "abc" is incremented to form the
  ** termination condition "abd".
  */
  if( pWC->op==TK_AND 
   && isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)
  ){
    Expr *pLeft;       /* LHS of LIKE/GLOB operator */
    Expr *pStr2;       /* Copy of pStr1 - RHS of LIKE/GLOB operator */
    Expr *pNewExpr1;
    Expr *pNewExpr2;
    int idxNew1;
    int idxNew2;

    pLeft = pExpr->x.pList->a[1].pExpr;
    pStr2 = sqlite3ExprDup(db, pStr1, 0);
    if( !db->mallocFailed ){
      u8 c, *pC;       /* Last character before the first wildcard */
      pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];
      c = *pC;
      if( noCase ){
        /* The point is to increment the last character before the first
        ** wildcard.  But if we increment '@', that will push it into the
        ** alphabetic range where case conversions will mess up the 
        ** inequality.  To avoid this, make sure to also run the full
        ** LIKE on all candidate expressions by clearing the isComplete flag
................................................................................
    assert( i>=0 && i<=SQLITE_INDEX_SAMPLES );
    *piRegion = i;
  }
  return SQLITE_OK;
}
#endif   /* #ifdef SQLITE_ENABLE_STAT2 */

/*
** If expression pExpr represents a literal value, set *pp to point to
** an sqlite3_value structure containing the same value, with affinity
** aff applied to it, before returning. It is the responsibility of the 
** caller to eventually release this structure by passing it to 
** sqlite3ValueFree().
**
** If the current parse is a recompile (sqlite3Reprepare()) and pExpr
** is an SQL variable that currently has a non-NULL value bound to it,
** create an sqlite3_value structure containing this value, again with
** affinity aff applied to it, instead.
**
** If neither of the above apply, set *pp to NULL.
**
** If an error occurs, return an error code. Otherwise, SQLITE_OK.
*/
#ifdef SQLITE_ENABLE_STAT2
static int valueFromExpr(
  Parse *pParse, 
  Expr *pExpr, 
  u8 aff, 
  sqlite3_value **pp
){
  /* The evalConstExpr() function will have already converted any TK_VARIABLE
  ** expression involved in an comparison into a TK_REGISTER. */
  assert( pExpr->op!=TK_VARIABLE );
  if( pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE ){
    int iVar = pExpr->iColumn;
    sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
    *pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff);
    return SQLITE_OK;
  }
  return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp);
}
#endif

/*
** This function is used to estimate the number of rows that will be visited
** by scanning an index for a range of values. The range may have an upper
** bound, a lower bound, or both. The WHERE clause terms that set the upper
** and lower bounds are represented by pLower and pUpper respectively. For
** example, assuming that index p is on t1(a):
**
................................................................................
  WhereTerm *pLower,   /* Lower bound on the range. ex: "x>123" Might be NULL */
  WhereTerm *pUpper,   /* Upper bound on the range. ex: "x<455" Might be NULL */
  int *piEst           /* OUT: Return value */
){
  int rc = SQLITE_OK;

#ifdef SQLITE_ENABLE_STAT2




  if( nEq==0 && p->aSample ){
    sqlite3_value *pLowerVal = 0;
    sqlite3_value *pUpperVal = 0;
    int iEst;
    int iLower = 0;
    int iUpper = SQLITE_INDEX_SAMPLES;
    u8 aff = p->pTable->aCol[p->aiColumn[0]].affinity;

    if( pLower ){
      Expr *pExpr = pLower->pExpr->pRight;
      rc = valueFromExpr(pParse, pExpr, aff, &pLowerVal);
    }
    if( rc==SQLITE_OK && pUpper ){
      Expr *pExpr = pUpper->pExpr->pRight;
      rc = valueFromExpr(pParse, pExpr, aff, &pUpperVal);
    }

    if( rc!=SQLITE_OK || (pLowerVal==0 && pUpperVal==0) ){
      sqlite3ValueFree(pLowerVal);
      sqlite3ValueFree(pUpperVal);
      goto range_est_fallback;
    }else if( pLowerVal==0 ){
................................................................................
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   312,   53,  494,   56,  143,  177,  181,  561,   44,   44,
 /*    10 */    44,   44,  224,   46,   46,   46,   46,   47,   47,   48,
 /*    20 */    48,   48,   49,  226,  511,  345,  209,  513,  501,  226,
 /*    30 */   550,  541,   54,   46,   46,   46,   46,   47,   47,   48,
 /*    40 */    48,   48,   49,  226,   48,   48,   48,   49,  226,   43,
 /*    50 */    41,   55,  539,  537,  540,  540,   45,   45,   44,   44,
 /*    60 */    44,   44,  252,   46,   46,   46,   46,   47,   47,   48,
 /*    70 */    48,   48,   49,  226,  312,  561,  321,  493,  429,  246,
 /*    80 */    60,   46,   46,   46,   46,   47,   47,   48,   48,   48,
 /*    90 */    49,  226,  613,  321,  493,  480,  477,  155,  426,  326,
 /*   100 */   369,  372,  373,  581,  550,  541,  311,  555,  155,   40,
 /*   110 */   374,  369,  372,  373,   47,   47,   48,   48,   48,   49,
 /*   120 */   226,  374,  536,   43,   41,   55,  539,  537,  540,  540,
 /*   130 */    45,   45,   44,   44,   44,   44,  301,   46,   46,   46,
 /*   140 */    46,   47,   47,   48,   48,   48,   49,  226,  312,  222,
 /*   150 */   210,  445,  431,  156,  139,  250,  366,  267,  367,  154,
 /*   160 */   509,  350,  513,  501,  561,  248,  222,  484,  513,  501,
 /*   170 */   340,  139,  250,  366,  267,  367,  154,  316,  550,  541,
 /*   180 */   609,  281,  248,  197,  565,  337,  309,  471,  428,  511,
 /*   190 */   582,  209,  556,  599,  566,   81,  493,   43,   41,   55,
 /*   200 */   539,  537,  540,  540,   45,   45,   44,   44,   44,   44,
 /*   210 */   471,   46,   46,   46,   46,   47,   47,   48,   48,   48,
 /*   220 */    49,  226,  312,  553,  553,  553,  287,  133,  517,  231,
 /*   230 */   480,  477,  561,  580,  355,  235,  480,  477,  483,  573,
 /*   240 */   340,  513,  501,  183,  591,   66,  571,  572,  493,  238,
 /*   250 */   205,  387,  550,  541,  155,  337,  390,  369,  372,  373,
 /*   260 */   959,  186,  490,    2,  566,   94,  466,  374,  195,  614,
 /*   270 */   198,   43,   41,   55,  539,  537,  540,  540,   45,   45,
 /*   280 */    44,   44,   44,   44,  565,   46,   46,   46,   46,   47,
 /*   290 */    47,   48,   48,   48,   49,  226,  312,  340,  570,   53,
 /*   300 */   618,   56,  143,  449,  565,  340,  353,  201,  141,  480,
 /*   310 */   477,  352,  337,  493,  400,  273,  200,  146,  569,  568,
 /*   320 */   337,  566,   71,  570,  224,  292,  550,  541,  361,  566,
 /*   330 */    94,  342,  483,  534,  534,   68,  360,  280,  493,  513,
 /*   340 */   501,  565,  381,  569,  410,   43,   41,   55,  539,  537,
 /*   350 */   540,  540,   45,   45,   44,   44,   44,   44,  462,   46,
 /*   360 */    46,   46,   46,   47,   47,   48,   48,   48,   49,  226,
 /*   370 */   312,  353,  468,  493,  246,  208,  363,    1,  340,  567,
 /*   380 */   230,  513,  501,  149,  333,  546,    4,  612,  617,  493,
 /*   390 */   240,  340,  112,  337,  611,  513,  501,  224,  212,  580,
 /*   400 */   550,  541,  566,   95,  409,  230,  337,  480,  477,  399,
 /*   410 */   482,   66,  471,  516,  493,  566,   94,  412,  466,   43,
 /*   420 */    41,   55,  539,  537,  540,  540,   45,   45,   44,   44,
 /*   430 */    44,   44,  565,   46,   46,   46,   46,   47,   47,   48,
 /*   440 */    48,   48,   49,  226,  312,  502,  585,  580,  329,  480,
 /*   450 */   477,  451,  513,  501,  592,  247,  332,  357,  615,   66,
 /*   460 */   150,  500,  493,  480,  477,  151,  400,  273,   53,  414,
 /*   470 */    56,  143,  215,  146,  550,  541,  224,  499,  617,  421,
 /*   480 */   317,  528,  524,   42,  282,  415,  594,   34,  476,  280,
 /*   490 */   420,  397,  203,   43,   41,   55,  539,  537,  540,  540,
 /*   500 */    45,   45,   44,   44,   44,   44,  493,   46,   46,   46,
 /*   510 */    46,   47,   47,   48,   48,   48,   49,  226,  312,  324,
 /*   520 */   480,  477,  435,  447,  439,  384,  565,  340,  284,  340,
 /*   530 */   241,  344,  528,  524,   53,  340,   56,  143,  620,  185,
 /*   540 */   461,  483,  337,  230,  337,  478,  217,  439,  550,  541,
 /*   550 */   337,  566,   95,  566,   89,  493,  596,  425,  227,  566,
 /*   560 */    81,   52,  459,  448,  440,  402,  584,   43,   41,   55,
 /*   570 */   539,  537,  540,  540,   45,   45,   44,   44,   44,   44,
 /*   580 */   565,   46,   46,   46,   46,   47,   47,   48,   48,   48,
 /*   590 */    49,  226,  312,  362,  230,  340,  259,  323,  491,  377,
 /*   600 */   234,  257,  458,  385,  398,  278,  283,  488,  337,  340,
 /*   610 */   337,  141,  340,  461,  340,  597,  493,  566,    9,  566,
 /*   620 */    96,   62,  550,  541,  337,  593,  401,  337,  493,  337,
 /*   630 */   151,  328,  157,  566,   85,  483,  566,   77,  566,   86,
 /*   640 */   874,   43,   41,   55,  539,  537,  540,  540,   45,   45,
 /*   650 */    44,   44,   44,   44,  340,   46,   46,   46,   46,   47,
 /*   660 */    47,   48,   48,   48,   49,  226,  312,  340,  444,  337,
 /*   670 */   364,   30,  443,  457,  502,  150,  327,   65,  566,   99,
 /*   680 */   340,  561,  337,  408,  324,  340,  386,  340,  248,  589,
 /*   690 */   500,  566,  137,  256,  574,  337,  550,  541,  579,  246,
 /*   700 */   337,  224,  337,  258,  566,  136,  499,  371,  349,  566,
 /*   710 */   138,  566,  101,  407,  493,   43,   41,   55,  539,  537,
 /*   720 */   540,  540,   45,   45,   44,   44,   44,   44,  340,   46,
 /*   730 */    46,   46,   46,   47,   47,   48,   48,   48,   49,  226,
 /*   740 */   312,  340,  229,  337,  340,  342,  252,  534,  534,  561,
 /*   750 */   522,  522,  566,   91,  574,  177,  337,  561,  579,  337,
 /*   760 */   340,  493,   58,  340,   38,  566,   88,  441,  566,   17,
 /*   770 */   550,  541,  508,   29,  306,  337,  452,  948,  337,  948,
 /*   780 */   629,  575,  416,  318,  566,   92,  192,  566,   73,   43,
 /*   790 */    41,   55,  539,  537,  540,  540,   45,   45,   44,   44,
 /*   800 */    44,   44,  340,   46,   46,   46,   46,   47,   47,   48,
 /*   810 */    48,   48,   49,  226,  312,  340,  246,  337,  340,  246,
 /*   820 */   270,  526,  340,  469,  299,  561,  566,   70,  202,  204,
 /*   830 */   337,  493,  507,  337,  493,  493,  340,  337,  493,  566,
 /*   840 */    90,  532,  566,   82,  550,  541,  566,   72,  557,  452,
 /*   850 */   949,  337,  949,  266,  598,  342,  150,  534,  534,  228,
 /*   860 */   566,   79,  533,   43,   41,   55,  539,  537,  540,  540,
 /*   870 */    45,   45,   44,   44,   44,   44,  340,   46,   46,   46,
 /*   880 */    46,   47,   47,   48,   48,   48,   49,  226,  312,  340,
 /*   890 */   246,  337,  340,  252,  526,   49,  226,  254,  549,  260,
 /*   900 */   566,   83,  588,  586,  337,  493,  606,  337,  493,  485,
 /*   910 */   340,  592,  392,  566,   69,  406,  566,   80,  550,  541,
 /*   920 */   342,  368,  534,  534,  253,  337,  150,  493,  604,  342,
 /*   930 */   223,  534,  534,  525,  566,  100,  285,   43,   57,   55,
 /*   940 */   539,  537,  540,  540,   45,   45,   44,   44,   44,   44,
 /*   950 */   340,   46,   46,   46,   46,   47,   47,   48,   48,   48,
 /*   960 */    49,  226,  312,  392,  246,  337,  340,  252,  575,  416,
 /*   970 */   351,  472,  276,  347,  566,   87,  279,  330,  493,  493,
 /*   980 */   496,  337,  493,  461,  340,  493,  493,  493,  548,  547,
 /*   990 */   566,   98,  550,  541,  498,  493,  172,  523,  493,  337,
 /*  1000 */   311,  577,  191,  243,  319,  423,  422,  530,  566,  105,
 /*  1010 */   544,  543,   41,   55,  539,  537,  540,  540,   45,   45,
 /*  1020 */    44,   44,   44,   44,  340,   46,   46,   46,   46,   47,
 /*  1030 */    47,   48,   48,   48,   49,  226,  312,  545,  340,  337,
 /*  1040 */   340,  246,  392,  207,  252,  445,  320,  489,  566,  103,
 /*  1050 */   627,  622,  519,  337,  232,  337,  493,  493,  340,  493,
 /*  1060 */   479,  340,  566,  108,  566,  109,  550,  541,    6,  607,
 /*  1070 */   608,  454,    2,  337,  492,  493,  337,  565,  517,  231,
 /*  1080 */   471,  322,  566,  134,  289,  566,  135,   55,  539,  537,
 /*  1090 */   540,  540,   45,   45,   44,   44,   44,   44,  487,   46,
 /*  1100 */    46,   46,   46,   47,   47,   48,   48,   48,   49,  226,
 /*  1110 */    23,  346,  340,    3,  397,  464,  422,  336,  501,  290,
 /*  1120 */   147,  214,    7,   23,  346,  340,    3,  337,  343,  493,
 /*  1130 */   336,  501,  463,  237,  172,  493,  566,   84,  475,  340,
 /*  1140 */   337,  343,  211,  340,  246,  225,  244,  348,  394,  566,
 /*  1150 */    75,  341,   18,  493,  337,  565,  393,  509,  337,  493,
 /*  1160 */   348,  493,  395,  566,   97,  245,  493,  566,   61,  274,
 /*  1170 */   509,  217,   16,  358,  189,  264,  565,   26,   25,  340,
 /*  1180 */   493,  236,  518,  310,   24,  338,  339,  304,  493,  556,
 /*  1190 */    26,   25,  450,  602,  337,  404,  120,   24,  338,  339,
 /*  1200 */   419,  169,  556,  566,  106,  565,  224,  117,  495,   27,
 /*  1210 */   346,  562,    3,  396,  187,  340,  336,  501,  179,  184,
 /*  1220 */   553,  553,  553,  552,  551,   11,  493,  343,  493,  398,
 /*  1230 */   337,  430,    8,  553,  553,  553,  552,  551,   11,  566,
 /*  1240 */   104,  335,  340,  255,  340,  616,  348,  340,  251,  331,
 /*  1250 */   340,  391,  558,  587,   50,  340,  509,  337,  493,  337,
 /*  1260 */   493,  365,  337,  493,  590,  337,  566,   78,  566,  102,
 /*  1270 */   337,  566,   76,  213,  566,   74,   26,   25,  610,  566,
 /*  1280 */    93,  378,  424,   24,  338,  339,  263,  583,  556,  220,
 /*  1290 */   140,  624,  294,  493,  300,  389,   23,  346,  376,    3,
 /*  1300 */   150,  493,  493,  336,  501,  493,  493,  493,  221,  493,
 /*  1310 */   493,  554,  268,  219,  343,  261,  515,  460,  418,  553,
 /*  1320 */   553,  553,  552,  551,   11,  595,  493,  493,  152,  206,
 /*  1330 */   493,  493,  493,  348,  272,  271,  269,  158,  302,  625,
 /*  1340 */   531,  521,   67,  509,  506,  520,   50,  628,  380,  600,
 /*  1350 */   173,  605,  123,  623,  493,  178,   37,  305,  308,  265,
 /*  1360 */   493,  620,  621,   26,   25,  165,  262,  307,  619,  166,
 /*  1370 */    24,  338,  339,  334,  436,  556,  427,  437,   33,  160,
 /*  1380 */   145,  466,  513,  501,   20,  148,  275,  122,  174,  359,
 /*  1390 */   442,  467,  486,   63,   36,  233,   42,  465,  512,  403,
 /*  1400 */   542,  182,  119,  113,  128,  132,  553,  553,  553,  552,
 /*  1410 */   551,   11,   39,  288,  538,  455,  291,  563,  388,  354,
 /*  1420 */   293,  295,  509,   31,  453,  356,  296,  325,  159,  405,
 /*  1430 */   286,  297,  564,  153,  313,  382,   35,  129,  303,  224,
 /*  1440 */   218,  121,  194,  196,  433,  107,  559,  242,  601,  216,
 /*  1450 */   428,  670,  280,  671,  556,  672,  162,  163,   32,  535,
 /*  1460 */    59,  505,  529,  411,  510,  190,  199,  176,  167,  504,
 /*  1470 */   503,  497,    5,  315,  314,   13,   19,   12,  474,  131,
 /*  1480 */   456,  144,  434,  432,  168,  553,  553,  553,  239,   51,
 /*  1490 */   603,  118,  111,  142,  249,   21,  124,  164,  379,  258,
 /*  1500 */   626,  188,  126,  172,  298,  383,  161,  370,  375,  114,
 /*  1510 */    15,  470,  481,  180,  125,  115,  127,  438,  446,   10,
 /*  1520 */   514,  110,  171,  527,  170,  116,  130,  560,   64,   14,
 /*  1530 */   175,  576,  578,  413,  277,  193,  417,  960,  473,  960,
 /*  1540 */    28,  960,   22,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    19,  222,  223,  224,  225,   24,   35,   26,   77,   78,
 /*    10 */    79,   80,  115,   82,   83,   84,   85,   86,   87,   88,
 /*    20 */    89,   90,   91,   92,  166,  167,  168,   26,   27,   92,
 /*    30 */    49,   50,   81,   82,   83,   84,   85,   86,   87,   88,
 /*    40 */    89,   90,   91,   92,   88,   89,   90,   91,   92,   68,
 /*    50 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*    60 */    79,   80,  150,   82,   83,   84,   85,   86,   87,   88,
 /*    70 */    89,   90,   91,   92,   19,   94,   19,  165,  174,  150,
 /*    80 */    25,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*    90 */    91,   92,  186,   19,  165,   94,   95,   96,  174,  187,
 /*   100 */    99,  100,  101,  186,   49,   50,   22,   23,   96,   54,
 /*   110 */   109,   99,  100,  101,   86,   87,   88,   89,   90,   91,
 /*   120 */    92,  109,  193,   68,   69,   70,   71,   72,   73,   74,
 /*   130 */    75,   76,   77,   78,   79,   80,  195,   82,   83,   84,
 /*   140 */    85,   86,   87,   88,   89,   90,   91,   92,   19,   92,
 /*   150 */   160,   67,   23,   96,   97,   98,   99,  100,  101,  102,
 /*   160 */    66,  191,   26,   27,   26,  108,   92,  208,   26,   27,
 /*   170 */   150,   97,   98,   99,  100,  101,  102,  155,   49,   50,
 /*   180 */   183,  150,  108,   25,  194,  165,  163,  166,   94,  166,
 /*   190 */   167,  168,   98,  183,  174,  175,  165,   68,   69,   70,
 /*   200 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   210 */   166,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   220 */    91,   92,   19,  129,  130,  131,  205,   24,   86,   87,
 /*   230 */    94,   95,   94,  150,  214,  215,   94,   95,   25,   97,
 /*   240 */   150,   26,   27,   23,  161,  162,  104,  105,  165,  205,
 /*   250 */   160,  229,   49,   50,   96,  165,  234,   99,  100,  101,
 /*   260 */   142,  143,  144,  145,  174,  175,   57,  109,  185,  186,
 /*   270 */   160,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   280 */    77,   78,   79,   80,  194,   82,   83,   84,   85,   86,
 /*   290 */    87,   88,   89,   90,   91,   92,   19,  150,  150,  222,
 /*   300 */    23,  224,  225,   88,  194,  150,  216,  160,   95,   94,
 /*   310 */    95,  221,  165,  165,  105,  106,  206,  207,  170,  171,
 /*   320 */   165,  174,  175,  150,  115,  148,   49,   50,   19,  174,
 /*   330 */   175,  111,  119,  113,  114,   22,   27,  128,  165,   26,
 /*   340 */    27,  194,  237,  170,  171,   68,   69,   70,   71,   72,
 /*   350 */    73,   74,   75,   76,   77,   78,   79,   80,  150,   82,
 /*   360 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*   370 */    19,  216,   11,  165,  150,  236,  221,   22,  150,  231,
 /*   380 */   232,   26,   27,   25,  146,  147,  196,  181,  182,  165,
 /*   390 */   152,  150,  154,  165,  188,   26,   27,  115,  160,  150,
 /*   400 */    49,   50,  174,  175,  231,  232,  165,   94,   95,  127,
 /*   410 */   161,  162,  166,  166,  165,  174,  175,  193,   57,   68,
 /*   420 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*   430 */    79,   80,  194,   82,   83,   84,   85,   86,   87,   88,
 /*   440 */    89,   90,   91,   92,   19,   12,  173,  150,  220,   94,
 /*   450 */    95,  205,   26,   27,  181,  158,  218,  216,  161,  162,
 /*   460 */    25,   28,  165,   94,   95,   50,  105,  106,  222,  245,
 /*   470 */   224,  225,  206,  207,   49,   50,  115,   44,  182,   46,
 /*   480 */   169,  170,  171,  125,   16,  247,  166,  136,  119,  128,
 /*   490 */    57,  150,  160,   68,   69,   70,   71,   72,   73,   74,
 /*   500 */    75,   76,   77,   78,   79,   80,  165,   82,   83,   84,
 /*   510 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  104,
 /*   520 */    94,   95,   23,   21,  105,  106,  194,  150,   60,  150,
 /*   530 */    62,  169,  170,  171,  222,  150,  224,  225,  103,   23,
 /*   540 */   150,   25,  165,  232,  165,  119,  160,  128,   49,   50,
 /*   550 */   165,  174,  175,  174,  175,  165,  244,  165,  217,  174,
 /*   560 */   175,  136,    7,    8,    9,   63,  174,   68,   69,   70,
 /*   570 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   580 */   194,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   590 */    91,   92,   19,  150,  232,  150,   23,  220,   32,   19,
 /*   600 */   215,  150,  100,  213,  218,  226,  138,   41,  165,  150,
 /*   610 */   165,   95,  150,  150,  150,  177,  165,  174,  175,  174,
 /*   620 */   175,  235,   49,   50,  165,  177,  240,  165,  165,  165,
 /*   630 */    50,  248,  249,  174,  175,  119,  174,  175,  174,  175,
 /*   640 */   138,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   650 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,
 /*   660 */    87,   88,   89,   90,   91,   92,   19,  150,   30,  165,
 /*   670 */    88,   24,   34,   23,   12,   25,  213,   22,  174,  175,
 /*   680 */   150,   26,  165,   97,  104,  150,   48,  150,  108,  166,
 /*   690 */    28,  174,  175,   98,  112,  165,   49,   50,  116,  150,
 /*   700 */   165,  115,  165,  108,  174,  175,   44,  178,   46,  174,
 /*   710 */   175,  174,  175,  127,  165,   68,   69,   70,   71,   72,
 /*   720 */    73,   74,   75,   76,   77,   78,   79,   80,  150,   82,
 /*   730 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*   740 */    19,  150,  193,  165,  150,  111,  150,  113,  114,   94,
 /*   750 */   129,  130,  174,  175,  112,   24,  165,   26,  116,  165,
 /*   760 */   150,  165,  135,  150,  137,  174,  175,   23,  174,  175,
 /*   770 */    49,   50,   23,   52,   25,  165,   22,   23,  165,   25,
 /*   780 */     0,    1,    2,  187,  174,  175,  196,  174,  175,   68,
 /*   790 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
 /*   800 */    79,   80,  150,   82,   83,   84,   85,   86,   87,   88,
 /*   810 */    89,   90,   91,   92,   19,  150,  150,  165,  150,  150,
 /*   820 */   150,   67,  150,  150,  198,   94,  174,  175,  105,  106,
 /*   830 */   165,  165,   23,  165,  165,  165,  150,  165,  165,  174,
 /*   840 */   175,   23,  174,  175,   49,   50,  174,  175,  166,   22,
 /*   850 */    23,  165,   25,   16,   23,  111,   25,  113,  114,  193,
 /*   860 */   174,  175,  193,   68,   69,   70,   71,   72,   73,   74,
 /*   870 */    75,   76,   77,   78,   79,   80,  150,   82,   83,   84,
 /*   880 */    85,   86,   87,   88,   89,   90,   91,   92,   19,  150,
 /*   890 */   150,  165,  150,  150,   67,   91,   92,   60,  199,   62,
 /*   900 */   174,  175,  172,  173,  165,  165,   36,  165,  165,   25,
 /*   910 */   150,  181,  150,  174,  175,  209,  174,  175,   49,   50,
 /*   920 */   111,   51,  113,  114,   23,  165,   25,  165,   58,  111,
 /*   930 */   187,  113,  114,  193,  174,  175,  209,   68,   69,   70,
 /*   940 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
 /*   950 */   150,   82,   83,   84,   85,   86,   87,   88,   89,   90,
 /*   960 */    91,   92,   19,  150,  150,  165,  150,  150,    1,    2,
 /*   970 */   150,  150,  150,  228,  174,  175,  242,  107,  165,  165,
 /*   980 */   150,  165,  165,  150,  150,  165,  165,  165,   49,   50,
 /*   990 */   174,  175,   49,   50,   23,  165,   25,  233,  165,  165,
 /*  1000 */    22,   23,  118,  241,  187,  190,  191,  193,  174,  175,
 /*  1010 */    71,   72,   69,   70,   71,   72,   73,   74,   75,   76,
 /*  1020 */    77,   78,   79,   80,  150,   82,   83,   84,   85,   86,
 /*  1030 */    87,   88,   89,   90,   91,   92,   19,   98,  150,  165,
 /*  1040 */   150,  150,  150,  160,  150,   67,  213,  199,  174,  175,
 /*  1050 */     7,    8,  233,  165,  241,  165,  165,  165,  150,  165,
 /*  1060 */   150,  150,  174,  175,  174,  175,   49,   50,   22,   97,
 /*  1070 */    98,  144,  145,  165,  177,  165,  165,  194,   86,   87,
 /*  1080 */   166,  187,  174,  175,  193,  174,  175,   70,   71,   72,
 /*  1090 */    73,   74,   75,   76,   77,   78,   79,   80,  177,   82,
 /*  1100 */    83,   84,   85,   86,   87,   88,   89,   90,   91,   92,
 /*  1110 */    19,   20,  150,   22,  150,  190,  191,   26,   27,  205,
 /*  1120 */   150,  160,   76,   19,   20,  150,   22,  165,   37,  165,
 /*  1130 */    26,   27,   23,  241,   25,  165,  174,  175,  150,  150,
 /*  1140 */   165,   37,  160,  150,  150,  197,  150,   56,   19,  174,
 /*  1150 */   175,  150,  204,  165,  165,  194,   27,   66,  165,  165,
 /*  1160 */    56,  165,  242,  174,  175,  150,  165,  174,  175,  209,
 /*  1170 */    66,  160,   22,  150,   24,  177,  194,   86,   87,  150,
 /*  1180 */   165,  217,  250,  251,   93,   94,   95,  193,  165,   98,
 /*  1190 */    86,   87,   88,  153,  165,   18,  192,   93,   94,   95,
 /*  1200 */    13,  151,   98,  174,  175,  194,  115,   22,  157,   19,
 /*  1210 */    20,  150,   22,  150,  219,  150,   26,   27,  117,  157,
 /*  1220 */   129,  130,  131,  132,  133,  134,  165,   37,  165,  218,
 /*  1230 */   165,  157,   25,  129,  130,  131,  132,  133,  134,  174,
 /*  1240 */   175,  159,  150,  150,  150,  150,   56,  150,  150,   47,
 /*  1250 */   150,  240,   23,  184,   25,  150,   66,  165,  165,  165,
 /*  1260 */   165,  104,  165,  165,  176,  165,  174,  175,  174,  175,
 /*  1270 */   165,  174,  175,  157,  174,  175,   86,   87,  150,  174,
 /*  1280 */   175,   18,  176,   93,   94,   95,  150,  150,   98,   92,
 /*  1290 */   150,  150,  150,  165,  150,  150,   19,   20,   23,   22,
 /*  1300 */    25,  165,  165,   26,   27,  165,  165,  165,  230,  165,
 /*  1310 */   165,  150,  150,  230,   37,  150,  150,  150,  184,  129,
 /*  1320 */   130,  131,  132,  133,  134,  176,  165,  165,  156,    5,
 /*  1330 */   165,  165,  165,   56,   10,   11,   12,   13,   14,  150,
 /*  1340 */    23,   17,   25,   66,   23,  150,   25,  176,  157,  176,
 /*  1350 */   156,   40,   22,  157,  165,   31,  243,   33,  179,  176,
 /*  1360 */   165,  103,  178,   86,   87,  156,   42,  179,  176,    6,
 /*  1370 */    93,   94,   95,  149,  157,   98,  149,  149,   22,   55,
 /*  1380 */    68,   57,   26,   27,  104,   61,  210,  189,   64,  120,
 /*  1390 */   157,  211,   38,  246,  135,  227,  125,  189,  199,  157,
 /*  1400 */   199,  219,  192,  192,  192,  189,  129,  130,  131,  132,
 /*  1410 */   133,  134,  124,  210,  149,  211,  210,  203,  157,  121,
 /*  1420 */   202,  201,   66,  123,  211,  122,  200,  157,  156,  105,
 /*  1430 */   106,  199,  194,  151,  110,   45,  135,  180,  238,  115,
 /*  1440 */   180,  126,   86,   87,  239,  164,    1,   15,   23,   22,
 /*  1450 */    94,  117,  128,  117,   98,  117,  117,  117,  243,  112,
 /*  1460 */    22,   11,   23,  139,   23,   22,   22,   25,  249,   23,
 /*  1470 */    23,   23,   35,  252,  252,   35,   25,   25,  119,   22,
 /*  1480 */    27,  117,   23,   23,   35,  129,  130,  131,   52,   22,
 /*  1490 */    29,   22,   22,   39,   23,   22,   22,  102,   19,  108,
 /*  1500 */    20,   24,  104,   25,  138,   43,  104,   52,   52,   22,
 /*  1510 */     5,    1,   27,  117,  107,  126,   53,   59,   53,   22,
 /*  1520 */     1,  118,   16,   20,  120,  107,  118,  127,   16,   22,
 /*  1530 */    15,   23,   23,   65,  140,   22,    3,  253,    4,  253,
 /*  1540 */    76,  253,   76,
};
#define YY_SHIFT_USE_DFLT (-104)
#define YY_SHIFT_MAX 417
static const short yy_shift_ofst[] = {
 /*     0 */   967, 1091, 1324, 1091, 1277, 1277,  142,  142,    1,  -19,
 /*    10 */  1277, 1277, 1277, 1277, 1277,  209,  136,  721, 1104, 1277,
 /*    20 */  1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
 /*    30 */  1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
 /*    40 */  1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
 /*    50 */  1277, 1277, 1277, 1277, 1277, 1190, 1277, 1277, 1277, 1277,
 /*    60 */  1277,  -49,  361,  136,  136,  992,  138,  992, -103,   55,
 /*    70 */   129,  499,  351,  647,  203,  277,  425,  573,  869,  795,
 /*    80 */   795,  795,  795,  795,  795,  795,  795,  795,  795,  795,
 /*    90 */   795,  795,  795,  795,  795,  795,  795,  795,  943, 1017,
 /*   100 */  1017,  -69,  -69,  -69,  -69,   -1,   -1,   57,   28,  -44,
 /*   110 */   136,  136,  502,  136,  136,  136,  136,  136,  136,  136,
 /*   120 */   136,  136,  136,  136,  136,  136,  136,  136,  136,  580,
 /*   130 */   136,  136,  136,  138,  804,  -63, -104, -104, -104, 1356,
 /*   140 */    74,  426,  433,  355,  215,  433,  313,  369,  136,  136,
 /*   150 */   136,  136,  136,  136,  136,  136,  136,  754,  136,  136,
 /*   160 */   136,  136,  136,  136,  136,  136,  136,  827,  136,  136,
 /*   170 */   136,  136,  136,  136,  136,  136,  136,  136,  136,  136,
 /*   180 */   136,  136,  586,  731,  731,  731,  780,  282, -103, -103,
 /*   190 */  -103, -104, -104, -104,   94,  158,   94,   12,  220,  662,
 /*   200 */   516,  744,  870,  809,  870,  818,  555,  634,  419,  655,
 /*   210 */   634,  634,  634,  638,  634,  213,  582,  634,  415,  566,
 /*   220 */   138,  566,  138,  435,  642,  884,  138,  358,  309,  309,
 /*   230 */   621,  621, 1129,  627,  566,  566,  358, 1129,  309,  566,
 /*   240 */  1150, 1177, 1187, 1185, 1101, 1101, 1101, 1207, 1202, 1157,
 /*   250 */  1157, 1101, 1197, 1157, 1263, 1197, 1157, 1101, 1202, 1157,
 /*   260 */  1263, 1101, 1311, 1330, 1157, 1258, 1263, 1157, 1330, 1363,
 /*   270 */  1101, 1363, 1363, 1312, 1280, 1269, 1101, 1354, 1259, 1271,
 /*   280 */  1312, 1101, 1177, 1177, 1177, 1271, 1312, 1280, 1269, 1185,
 /*   290 */  1280, 1269, 1363, 1288, 1101, 1298, 1300, 1303, 1263, 1271,
 /*   300 */  1101, -103, 1187, 1301, 1390, 1311, -104, -104, -104, -104,
 /*   310 */  -104, -104,  939,  468,  978,   84,  837, 1317,  650,  831,
 /*   320 */   971,  595, 1275, 1321,  723, 1046,  901, 1109,  749, 1229,
 /*   330 */   972, 1043, 1315, 1445, 1432, 1425, 1427, 1334, 1336, 1338,
 /*   340 */  1339, 1340, 1347, 1438, 1439, 1441, 1443, 1450, 1444, 1446,
 /*   350 */  1442, 1447, 1448, 1451, 1437, 1452, 1440, 1451, 1359, 1457,
 /*   360 */  1449, 1453, 1364, 1459, 1460, 1454, 1436, 1467, 1461, 1455,
 /*   370 */  1469, 1471, 1470, 1473, 1456, 1474, 1395, 1391, 1479, 1480,
 /*   380 */  1477, 1398, 1462, 1458, 1463, 1478, 1465, 1366, 1402, 1487,
 /*   390 */  1505, 1510, 1396,  -29, 1485, 1407, 1464, 1466, 1389, 1497,
 /*   400 */  1403, 1519, 1506, 1404, 1503, 1408, 1418, 1507, 1400, 1508,
 /*   410 */  1509, 1512, 1468, 1515, 1394, 1513, 1533, 1534,
};
#define YY_REDUCE_USE_DFLT (-222)
#define YY_REDUCE_MAX 311
static const short yy_reduce_ofst[] = {
 /*     0 */   118,   90,  238,  147,  155,   20,  173,  148,   83,  246,
 /*    10 */   377,  379,  385,  241,  228,  386,  297,  312,  443,  445,
 /*    20 */   459,  462,  464,  504,  517,  530,  535,  537,  578,  591,
 /*    30 */   594,  610,  613,  652,  665,  668,  672,  686,  726,  739,
 /*    40 */   742,  760,  800,  816,  834,  874,  888,  890,  908,  911,
 /*    50 */   962,  975,  989,  993, 1029, 1065, 1092, 1094, 1097, 1100,
 /*    60 */  1105, -221, 1011,  249,  224,  311,   23,  362,  110,   77,
 /*    70 */    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
 /*    80 */    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
 /*    90 */    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
 /*   100 */    77,   77,   77,   77,   77,   77,   77,  730,   77,   77,
 /*   110 */   813,  -88,   22,  669,  596,  762,  341,  833,  743,  740,
 /*   120 */   814,  891,  892,  817,  894,  964,  994,  390,  -71,  206,
 /*   130 */   549,  463,  666, -142,   77,   77,   77,   77,   77,  392,
 /*   140 */   273,  970,  815,  996, 1001,  925, 1015, 1023, 1061, 1063,
 /*   150 */  1093, 1095, 1098, 1128, 1136, 1137, 1140,  932, 1141, 1142,
 /*   160 */  1144, 1145, 1001, 1161, 1162, 1165, 1166,  932, 1167, 1189,
 /*   170 */  1195,   31,  208,  451,  670,  673,  820,  821,  822,  830,
 /*   180 */   988,  910,  -10,   21,   44,  914,  927,  883,  961,  982,
 /*   190 */   332,  266,  948,  383,  -96,  -94,  -76,  -83,  -59,  -30,
 /*   200 */   -41,  -59,   -3,  -59,   10,  -59,  177,  -59,  105,  247,
 /*   210 */   -59,  -59,  -59,  139,  -59,  -41,  190,  -59,  296,  438,
 /*   220 */   320,  448,  523,  529,  590,  626,  682,  699,  706,  727,
 /*   230 */   764,  819,  734,  745,  897,  921,  848,  920,  960,  998,
 /*   240 */  1040, 1004, 1050,  995, 1051, 1062, 1074, 1082, 1069, 1088,
 /*   250 */  1106, 1116, 1078, 1149, 1172, 1083, 1171, 1191, 1134, 1173,
 /*   260 */  1194, 1196, 1113, 1179, 1183, 1184, 1209, 1192, 1188, 1224,
 /*   270 */  1217, 1227, 1228, 1198, 1176, 1180, 1233, 1147, 1168, 1199,
 /*   280 */  1208, 1242, 1210, 1211, 1212, 1201, 1216, 1203, 1204, 1182,
 /*   290 */  1206, 1213, 1265, 1214, 1261, 1218, 1220, 1226, 1272, 1232,
 /*   300 */  1270, 1238, 1282, 1205, 1200, 1215, 1219, 1257, 1260, 1281,
 /*   310 */  1221, 1222,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   634,  869,  958,  958,  869,  958,  898,  898,  958,  757,
 /*    10 */   958,  867,  958,  958,  958,  958,  958,  932,  958,  958,
 /*    20 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    30 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    40 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    50 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*    60 */   958,  841,  958,  958,  958,  898,  673,  898,  761,  792,
 /*    70 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  931,
 /*    80 */   793,  783,  911,  864,  806,  772,  800,  797,  933,  866,
 /*    90 */   863,  799,  790,  794,  871,  807,  870,  862,  829,  847,
 /*   100 */   828,  846,  853,  831,  845,  830,  840,  665,  832,  833,
 /*   110 */   958,  958,  660,  958,  958,  958,  958,  958,  958,  958,
 /*   120 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  726,
 /*   130 */   958,  958,  958,  958,  834,  835,  849,  848,  850,  958,
 /*   140 */   958,  958,  958,  958,  958,  958,  958,  958,  882,  958,
 /*   150 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   160 */   958,  958,  958,  958,  958,  958,  640,  958,  958,  958,
 /*   170 */   958,  958,  958,  958,  936,  958,  958,  958,  938,  958,
 /*   180 */   958,  958,  958,  757,  757,  757,  634,  958,  958,  958,
 /*   190 */   958,  761,  751,  950,  958,  717,  958,  958,  958,  958,
 /*   200 */   958,  958,  958,  958,  958,  958,  642,  921,  958,  675,
 /*   210 */   802,  662,  740,  904,  738,  759,  749,  923,  696,  786,
 /*   220 */   958,  786,  958,  699,  749,  758,  958,  796,  774,  774,
 /*   230 */   958,  958,  916,  865,  786,  786,  796,  916,  774,  786,
 /*   240 */   958,  737,  650,  808,  765,  765,  765,  716,  713,  728,
 /*   250 */   728,  765,  879,  728,  657,  879,  728,  765,  713,  728,
 /*   260 */   657,  765,  935,  875,  728,  699,  657,  728,  875,  639,
 /*   270 */   765,  639,  639,  730,  773,  778,  765,  943,  958,  796,
 /*   280 */   730,  765,  737,  737,  737,  796,  730,  773,  778,  808,
 /*   290 */   773,  778,  639,  791,  765,  779,  789,  787,  657,  796,
 /*   300 */   765,  958,  650,  910,  908,  935,  950,  701,  701,  683,
 /*   310 */   955,  955,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   320 */   958,  958,  958,  958,  958,  884,  958,  958,  958,  958,
 /*   330 */   958,  958,  958,  958,  648,  958,  667,  815,  820,  816,
 /*   340 */   958,  817,  743,  958,  958,  958,  958,  958,  958,  958,
 /*   350 */   958,  958,  958,  868,  958,  780,  958,  788,  958,  958,
 /*   360 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   370 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   380 */   958,  958,  958,  958,  906,  907,  958,  958,  958,  958,
 /*   390 */   958,  958,  914,  958,  958,  958,  958,  958,  958,  958,
 /*   400 */   958,  958,  958,  958,  958,  958,  958,  958,  958,  958,
 /*   410 */   958,  958,  942,  958,  958,  945,  635,  958,  711,  649,
 /*   420 */   734,  733,  732,  729,  691,  690,  689,  647,  820,  688,
 /*   430 */   767,  687,  826,  900,  825,  813,  937,  646,  909,  905,
 /*   440 */   645,  857,  939,  901,  902,  957,  903,  659,  644,  754,
 /*   450 */   753,  752,  954,  764,  630,  763,  776,  872,  873,  643,
 /*   460 */   775,  811,  810,  777,  731,  804,  805,  762,  899,  940,
 /*   470 */   912,  756,  755,  636,  771,  915,  770,  672,  769,  917,
 /*   480 */   671,  918,  941,  768,  760,  750,  944,  782,  785,  919,
 /*   490 */   631,  784,  781,  670,  842,  859,  766,  856,  809,  928,
 /*   500 */   927,  668,  926,  925,  924,  861,  920,  860,  946,  827,
 /*   510 */   824,  678,  922,  667,  913,  641,  679,  897,  951,  895,
 /*   520 */   947,  656,  896,  894,  681,  735,  952,  736,  680,  677,
 /*   530 */   739,  676,  858,  881,  745,  744,  929,  854,  638,  851,
 /*   540 */   843,  838,  795,  855,  852,  844,  637,  839,  837,  798,
 /*   550 */   836,  822,  821,  819,  818,  953,  814,  823,  801,  633,
 /*   560 */   803,  669,  883,  746,  742,  741,  812,  885,  887,  889,
 /*   570 */   890,  891,  892,  893,  748,  632,  886,  956,  888,  747,
 /*   580 */   666,  718,  674,  721,  686,  684,  685,  712,  682,  698,
 /*   590 */   722,  663,  697,  878,  880,  723,  930,  877,  876,  705,
 /*   600 */   724,  661,  654,  710,  709,  934,  708,  707,  706,  704,
 /*   610 */   652,  725,  727,  719,  720,  664,  703,  702,  695,  694,
 /*   620 */   700,  693,  715,  655,  651,  653,  658,  714,  692,
};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))

/* The next table maps tokens into fallback tokens.  If a construct
** like the following:
** 
**      %fallback ID X Y Z.
................................................................................
      case 68: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy328);}
        break;
      case 69: /* ccons ::= COLLATE ids */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
        break;
      case 72: /* refargs ::= */
{ yygotominor.yy328 = OE_None*0x0101; /* EV: R-19803-45884 */}
        break;
      case 73: /* refargs ::= refargs refarg */
{ yygotominor.yy328 = (yymsp[-1].minor.yy328 & ~yymsp[0].minor.yy429.mask) | yymsp[0].minor.yy429.value; }
        break;
      case 74: /* refarg ::= MATCH nm */
{ yygotominor.yy429.value = 0;     yygotominor.yy429.mask = 0x000000; }
        break;
................................................................................
      case 75: /* refarg ::= ON DELETE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328;     yygotominor.yy429.mask = 0x0000ff; }
        break;
      case 76: /* refarg ::= ON UPDATE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328<<8;  yygotominor.yy429.mask = 0x00ff00; }
        break;
      case 77: /* refact ::= SET NULL */
{ yygotominor.yy328 = OE_SetNull;  /* EV: R-33326-45252 */}
        break;
      case 78: /* refact ::= SET DEFAULT */
{ yygotominor.yy328 = OE_SetDflt;  /* EV: R-33326-45252 */}
        break;
      case 79: /* refact ::= CASCADE */
{ yygotominor.yy328 = OE_Cascade;  /* EV: R-33326-45252 */}
        break;
      case 80: /* refact ::= RESTRICT */
{ yygotominor.yy328 = OE_Restrict; /* EV: R-33326-45252 */}
        break;
      case 81: /* refact ::= NO ACTION */
{ yygotominor.yy328 = OE_None;     /* EV: R-33326-45252 */}
        break;
      case 83: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 98: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==98);
      case 100: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==100);
      case 103: /* resolvetype ::= raisetype */ yytestcase(yyruleno==103);
{yygotominor.yy328 = yymsp[0].minor.yy328;}
        break;
................................................................................
      42,  12,  74,  15,   0, 113,  81,  50, 108,   0,  19,   0,   0,
     118,   0, 116, 111,   0,  22,  89,   0,   9,   0,   0,  66,  67,
       0,  65,   6,   0,  48,  86,  98,   0, 115,  97,   0,   0,  45,
       0,  99,  24,   0,  17,   0, 119,  49,  23,   0,   5, 106,  25,
      92,   0,   0, 121, 102,  56, 120,  53,  28,  51,   0,  87,   0,
      96,  26,   0,  95,   0,   0,   0,  91,  88,  93,  84, 105,  14,
      39, 104,   0,  77,   0,  18,  85, 107,  32,   0, 117,  76, 109,
      57,  46,  80,   0,   0,  90,  40,   0, 112,   0,  36,   0,   0,
      29,   0,  82,  59,  60,   0,  20,  58,   0,  52,
  };
  static const unsigned char aNext[121] = {
       0,   0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   2,   0,   0,   0,   0,   0,   0,  13,   0,   0,   0,   0,
       0,   7,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   0,   0,  33,  21,   0,   0,   0,  43,   3,  47,
       0,   0,   0,   0,   0,  30,  54,   0,  38,   0,   0,   0,   1,
      62,   0,   0,  63,   0,  41,   0,   0,   0,   0,   0,   0,   0,
      61,   0,   0,   0,   0,  31,  55,  16,  34,  10,   0,   0,   0,
       0,   0,   0,   0,  11,  68,  75,   0,   8,   0, 100,  94,   0,
     103,   0,  83,   0,  71,   0,   0, 110,  27,  37,  69,  79,   0,
      35,  64,   0,   0,
  };
  static const unsigned char aLen[121] = {
       7,   7,   5,   4,   6,   4,   5,   3,   6,   7,   3,   6,   6,
       7,   7,   3,   8,   2,   6,   5,   4,   4,   3,  10,   4,   6,
      11,   6,   2,   7,   5,   5,   9,   6,   9,   9,   7,  10,  10,
       4,   6,   2,   3,   4,   9,   2,   6,   5,   6,   6,   5,   6,
       5,   5,   7,   7,   3,   7,   2,   4,   4,   7,   3,   6,   4,
       7,   6,  12,   6,   9,   4,   6,   5,   4,   7,   6,   5,   6,
       7,   5,   4,   5,   6,   5,   7,   3,   7,  13,   2,   2,   4,
       6,   6,   8,   5,  17,  12,   7,   8,   8,   2,   4,   4,   4,
       4,   4,   2,   2,   6,   5,   8,   5,   5,   8,   3,   5,   5,
       6,   4,   9,   3,
  };
  static const unsigned short int aOffset[121] = {
................................................................................
    TK_JOIN_KW,    TK_THEN,       TK_END,        TK_DEFERRABLE, TK_ELSE,       
    TK_EXCEPT,     TK_TRANSACTION,TK_ACTION,     TK_ON,         TK_JOIN_KW,    
    TK_ALTER,      TK_RAISE,      TK_EXCLUSIVE,  TK_EXISTS,     TK_SAVEPOINT,  
    TK_INTERSECT,  TK_TRIGGER,    TK_REFERENCES, TK_CONSTRAINT, TK_INTO,       
    TK_OFFSET,     TK_OF,         TK_SET,        TK_TEMP,       TK_TEMP,       
    TK_OR,         TK_UNIQUE,     TK_QUERY,      TK_ATTACH,     TK_HAVING,     
    TK_GROUP,      TK_UPDATE,     TK_BEGIN,      TK_JOIN_KW,    TK_RELEASE,    
    TK_BETWEEN,    TK_NOT,        TK_NOTNULL,    TK_NO,         TK_NULL,       
    TK_LIKE_KW,    TK_CASCADE,    TK_ASC,        TK_DELETE,     TK_CASE,       
    TK_COLLATE,    TK_CREATE,     TK_CTIME_KW,   TK_DETACH,     TK_IMMEDIATE,  
    TK_JOIN,       TK_INSERT,     TK_MATCH,      TK_PLAN,       TK_ANALYZE,    
    TK_PRAGMA,     TK_ABORT,      TK_VALUES,     TK_VIRTUAL,    TK_LIMIT,      
    TK_WHEN,       TK_WHERE,      TK_RENAME,     TK_AFTER,      TK_REPLACE,    
    TK_AND,        TK_DEFAULT,    TK_AUTOINCR,   TK_TO,         TK_IN,         
    TK_CAST,       TK_COLUMNKW,   TK_COMMIT,     TK_CONFLICT,   TK_JOIN_KW,    
................................................................................
      testcase( i==49 ); /* HAVING */
      testcase( i==50 ); /* GROUP */
      testcase( i==51 ); /* UPDATE */
      testcase( i==52 ); /* BEGIN */
      testcase( i==53 ); /* INNER */
      testcase( i==54 ); /* RELEASE */
      testcase( i==55 ); /* BETWEEN */
      testcase( i==56 ); /* NOT */
      testcase( i==57 ); /* NOTNULL */
      testcase( i==58 ); /* NO */
      testcase( i==59 ); /* NULL */
      testcase( i==60 ); /* LIKE */
      testcase( i==61 ); /* CASCADE */
      testcase( i==62 ); /* ASC */
      testcase( i==63 ); /* DELETE */
      testcase( i==64 ); /* CASE */
      testcase( i==65 ); /* COLLATE */
................................................................................
#endif
#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30
# error SQLITE_MAX_ATTACHED must be between 0 and 30
#endif
#if SQLITE_MAX_LIKE_PATTERN_LENGTH<1
# error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1
#endif
#if SQLITE_MAX_VARIABLE_NUMBER<1 || SQLITE_MAX_VARIABLE_NUMBER>32767
# error SQLITE_MAX_VARIABLE_NUMBER must be between 1 and 32767
#endif
#if SQLITE_MAX_COLUMN>32767
# error SQLITE_MAX_COLUMN must not exceed 32767
#endif
#if SQLITE_MAX_TRIGGER_DEPTH<1
# error SQLITE_MAX_TRIGGER_DEPTH must be at least 1
#endif

Changes to src/sqlite3.h.

115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
...
831
832
833
834
835
836
837



838
839
840
841
842
843
844
845
846
847
848
849
850






851
852
853
854
855
856
857
858
859
860
....
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
....
2414
2415
2416
2417
2418
2419
2420








2421
2422
2423
2424
2425
2426
2427
....
2946
2947
2948
2949
2950
2951
2952


2953
2954
2955
2956
2957
2958
2959
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION        "3.6.19"
#define SQLITE_VERSION_NUMBER 3006019
#define SQLITE_SOURCE_ID      "2009-10-14 11:33:55 c1d499afc50d54b376945b4efb65c56c787a073d"

/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
................................................................................
#endif

/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
** Applications should [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** the [sqlite3] object prior to attempting to close the object.
** The [sqlite3_next_stmt()] interface can be used to locate all
** [prepared statements] associated with a [database connection] if desired.
** Typical code might look like this:
**
** <blockquote><pre>
** sqlite3_stmt *pStmt;
** while( (pStmt = sqlite3_next_stmt(db, 0))!=0 ){
** &nbsp;   sqlite3_finalize(pStmt);
** }
** </pre></blockquote>
**
** If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
................................................................................

/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library.  The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().



**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown().  Only an effective call
** of sqlite3_initialize() does any initialization.  All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
** an effective call to sqlite3_shutdown() does any deinitialization.
** All other calls to sqlite3_shutdown() are harmless no-ops.
**






** Among other things, sqlite3_initialize() shall invoke
** sqlite3_os_init().  Similarly, sqlite3_shutdown()
** shall invoke sqlite3_os_end().
**
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
** If for some reason, sqlite3_initialize() is unable to initialize
** the library (perhaps it is unable to allocate a needed resource such
** as a mutex) it returns an [error code] other than [SQLITE_OK].
**
** The sqlite3_initialize() routine is called internally by many other
................................................................................
**
** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
** recommended for all new programs. The two older interfaces are retained
** for backwards compatibility, but their use is discouraged.
** In the "v2" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave a differently in two ways:
**
** <ol>
** <li>
** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
** always used to do, [sqlite3_step()] will automatically recompile the SQL
** statement and try to run it again.  If the schema has changed in
** a way that makes the statement no longer valid, [sqlite3_step()] will still
................................................................................
** When an error occurs, [sqlite3_step()] will return one of the detailed
** [error codes] or [extended error codes].  The legacy behavior was that
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and you would have to make a second call to [sqlite3_reset()] in order
** to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>








** </ol>
**
** Requirements:
** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021]
**
*/
SQLITE_API int sqlite3_prepare(
................................................................................
**
** These routines return information about a single column of the current
** result row of a query.  In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
** that was returned from [sqlite3_prepare_v2()] or one of its variants)
** and the second argument is the index of the column for which information
** should be returned.  The leftmost column of the result set has the index 0.


**
** If the SQL statement does not currently point to a valid row, or if the
** column index is out of range, the result is undefined.
** These routines may only be called when the most recent call to
** [sqlite3_step()] has returned [SQLITE_ROW] and neither
** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
** If any of these routines are called after [sqlite3_reset()] or







|
|
|







 







|


<
<
<
<
<
<
<
<
<
<







 







>
>
>











|

>
>
>
>
>
>
|

|







 







|







 







>
>
>
>
>
>
>
>







 







>
>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
241
242
243
244
245
246
247
248
249
250










251
252
253
254
255
256
257
...
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
....
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
....
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
....
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION        "3.6.20"
#define SQLITE_VERSION_NUMBER 3006020
#define SQLITE_SOURCE_ID      "2009-10-30 14:27:15 612952743da28e651512547fc0d3925f4c698eb4"

/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
................................................................................
#endif

/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
** Applications must [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** the [sqlite3] object prior to attempting to close the object.










**
** If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
................................................................................

/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library.  The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().
** This routines are designed to aid in process initialization and
** shutdown on embedded systems.  Workstation applications using
** SQLite normally do not need to invoke either of these routines.
**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown().  Only an effective call
** of sqlite3_initialize() does any initialization.  All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
** an effective call to sqlite3_shutdown() does any deinitialization.
** All other valid calls to sqlite3_shutdown() are harmless no-ops.
**
** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
** is not.  The sqlite3_shutdown() interface must only be called from a
** single thread.  All open [database connections] must be closed and all
** other SQLite resources must be deallocated prior to invoking
** sqlite3_shutdown().
**
** Among other things, sqlite3_initialize() will invoke
** sqlite3_os_init().  Similarly, sqlite3_shutdown()
** will invoke sqlite3_os_end().
**
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
** If for some reason, sqlite3_initialize() is unable to initialize
** the library (perhaps it is unable to allocate a needed resource such
** as a mutex) it returns an [error code] other than [SQLITE_OK].
**
** The sqlite3_initialize() routine is called internally by many other
................................................................................
**
** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
** recommended for all new programs. The two older interfaces are retained
** for backwards compatibility, but their use is discouraged.
** In the "v2" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave a differently in three ways:
**
** <ol>
** <li>
** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
** always used to do, [sqlite3_step()] will automatically recompile the SQL
** statement and try to run it again.  If the schema has changed in
** a way that makes the statement no longer valid, [sqlite3_step()] will still
................................................................................
** When an error occurs, [sqlite3_step()] will return one of the detailed
** [error codes] or [extended error codes].  The legacy behavior was that
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and you would have to make a second call to [sqlite3_reset()] in order
** to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>
**
** <li>
** ^If the value of a [parameter | host parameter] in the WHERE clause might
** change the query plan for a statement, then the statement may be
** automatically recompiled (as if there had been a schema change) on the first 
** [sqlite3_step()] call following any change to the 
** [sqlite3_bind_text | bindings] of the [parameter]. 
** </li>
** </ol>
**
** Requirements:
** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021]
**
*/
SQLITE_API int sqlite3_prepare(
................................................................................
**
** These routines return information about a single column of the current
** result row of a query.  In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
** that was returned from [sqlite3_prepare_v2()] or one of its variants)
** and the second argument is the index of the column for which information
** should be returned.  The leftmost column of the result set has the index 0.
** The number of columns in the result can be determined using
** [sqlite3_column_count()].
**
** If the SQL statement does not currently point to a valid row, or if the
** column index is out of range, the result is undefined.
** These routines may only be called when the most recent call to
** [sqlite3_step()] has returned [SQLITE_ROW] and neither
** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
** If any of these routines are called after [sqlite3_reset()] or

Changes to src/th.c.

1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
    /* Argument values */
    int iLeft;
    int iRight;
    double fLeft;
    double fRight;

    /* Left and right arguments as strings */
    char *zLeft = 0; int nLeft;
    char *zRight = 0; int nRight;

    /* Evaluate left and right arguments, if they exist. */
    if( pExpr->pLeft ){
      rc = exprEval(interp, pExpr->pLeft);
      if( rc==TH_OK ){
        zLeft = Th_TakeResult(interp, &nLeft);
      }







|
|







1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
    /* Argument values */
    int iLeft;
    int iRight;
    double fLeft;
    double fRight;

    /* Left and right arguments as strings */
    char *zLeft = 0; int nLeft = 0;
    char *zRight = 0; int nRight = 0;

    /* Evaluate left and right arguments, if they exist. */
    if( pExpr->pLeft ){
      rc = exprEval(interp, pExpr->pLeft);
      if( rc==TH_OK ){
        zLeft = Th_TakeResult(interp, &nLeft);
      }